annotate tests/test-git-clone.t @ 1057:312c4bb96e68

tests: update globs so ssh command injection tests pass on macOS
author Kevin Bullock <kbullock@ringworld.org>
date Mon, 23 Oct 2017 14:41:36 -0500
parents c35751c248c3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
575
a7da97e69d56 tests: extract extension configuration into a testutil library
David M. Carr <david@carrclan.us>
parents: 566
diff changeset
1 Load commonly used test logic
a7da97e69d56 tests: extract extension configuration into a testutil library
David M. Carr <david@carrclan.us>
parents: 566
diff changeset
2 $ . "$TESTDIR/testutil"
a7da97e69d56 tests: extract extension configuration into a testutil library
David M. Carr <david@carrclan.us>
parents: 566
diff changeset
3
578
935c4fb1bbfc tests: let git init create directories when applicable
David M. Carr <david@carrclan.us>
parents: 576
diff changeset
4 $ git init gitrepo
935c4fb1bbfc tests: let git init create directories when applicable
David M. Carr <david@carrclan.us>
parents: 576
diff changeset
5 Initialized empty Git repository in $TESTTMP/gitrepo/.git/
500
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
6 $ cd gitrepo
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
7 $ echo alpha > alpha
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
8 $ git add alpha
576
c4849b2dab87 tests: extract commonly used commit/tag functions into testutil library
David M. Carr <david@carrclan.us>
parents: 575
diff changeset
9 $ fn_git_commit -m 'add alpha'
500
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
10 $ echo beta > beta
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
11 $ git add beta
576
c4849b2dab87 tests: extract commonly used commit/tag functions into testutil library
David M. Carr <david@carrclan.us>
parents: 575
diff changeset
12 $ fn_git_commit -m 'add beta'
500
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
13
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
14 $ cd ..
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15
500
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
16 $ hg clone gitrepo hgrepo | grep -v '^updating'
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
17 importing git objects into hg
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
18 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
871
93689e8f27ac tests: stop filtering out bookmark output
Siddharth Agarwal <sid0@fb.com>
parents: 845
diff changeset
19 $ hg -R hgrepo log --graph
845
fffe8883960b git_handler: mark source for rename info as Git or Mercurial
Siddharth Agarwal <sid0@fb.com>
parents: 694
diff changeset
20 @ changeset: 1:7fe02317c63d
871
93689e8f27ac tests: stop filtering out bookmark output
Siddharth Agarwal <sid0@fb.com>
parents: 845
diff changeset
21 | bookmark: master
500
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
22 | tag: default/master
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
23 | tag: tip
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
24 | user: test <test@example.org>
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
25 | date: Mon Jan 01 00:00:11 2007 +0000
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
26 | summary: add beta
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
27 |
845
fffe8883960b git_handler: mark source for rename info as Git or Mercurial
Siddharth Agarwal <sid0@fb.com>
parents: 694
diff changeset
28 o changeset: 0:ff7a2f2d8d70
500
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
29 user: test <test@example.org>
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
30 date: Mon Jan 01 00:00:10 2007 +0000
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
31 summary: add alpha
deb7f683e0d5 tests: unify test-git-clone
David M. Carr <david@carrclan.us>
parents: 390
diff changeset
32
18
feab56c76c92 Add a basic test for cloning.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33
581
52461f71a782 tests: convert echos to comments
David M. Carr <david@carrclan.us>
parents: 580
diff changeset
34 we should have some bookmarks
580
6cc99298b69e tests: avoid changing the current directory
David M. Carr <david@carrclan.us>
parents: 579
diff changeset
35 $ hg -R hgrepo book
845
fffe8883960b git_handler: mark source for rename info as Git or Mercurial
Siddharth Agarwal <sid0@fb.com>
parents: 694
diff changeset
36 * master 1:7fe02317c63d
694
9b194d7c9c03 verify: add new command to verify the contents of a Mercurial rev
Siddharth Agarwal <sid0@fb.com>
parents: 581
diff changeset
37 $ hg -R hgrepo gverify
845
fffe8883960b git_handler: mark source for rename info as Git or Mercurial
Siddharth Agarwal <sid0@fb.com>
parents: 694
diff changeset
38 verifying rev 7fe02317c63d against git commit 9497a4ee62e16ee641860d7677cdb2589ea15554
1043
b4d2180739bb ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents: 871
diff changeset
39
b4d2180739bb ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents: 871
diff changeset
40 test for ssh vulnerability
b4d2180739bb ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents: 871
diff changeset
41
1045
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
42 $ cat >> $HGRCPATH << EOF
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
43 > [ui]
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
44 > ssh = ssh -o ConnectTimeout=1
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
45 > EOF
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
46
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
47 $ hg clone 'git+ssh://-oProxyCommand=rm${IFS}nonexistent/path' 2>&1 >/dev/null
1043
b4d2180739bb ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents: 871
diff changeset
48 abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent'
1045
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
49 [255]
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
50 $ hg clone 'git+ssh://%2DoProxyCommand=rm${IFS}nonexistent/path' 2>&1 >/dev/null
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
51 abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent'
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
52 [255]
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
53 $ hg clone 'git+ssh://fakehost|rm${IFS}nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
1057
312c4bb96e68 tests: update globs so ssh command injection tests pass on macOS
Kevin Bullock <kbullock@ringworld.org>
parents: 1045
diff changeset
54 ssh: * fakehost%7crm%24%7bifs%7dnonexistent* (glob)
1045
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
55 abort: git remote error: The remote server unexpectedly closed the connection.
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
56 $ hg clone 'git+ssh://fakehost%7Crm${IFS}nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
1057
312c4bb96e68 tests: update globs so ssh command injection tests pass on macOS
Kevin Bullock <kbullock@ringworld.org>
parents: 1045
diff changeset
57 ssh: * fakehost%7crm%24%7bifs%7dnonexistent* (glob)
1045
c35751c248c3 ssh: unban the use of pipe character in hostname
Kevin Bullock <kbullock@ringworld.org>
parents: 1044
diff changeset
58 abort: git remote error: The remote server unexpectedly closed the connection.