Mercurial > hg-git
annotate tests/test-git-clone.t @ 1042:b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
author | Sean Farley <sean@farley.io> |
---|---|
date | Fri, 04 Aug 2017 14:34:57 -0700 |
parents | 93689e8f27ac |
children | 9b09dd0a6308 |
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 |
870
93689e8f27ac
tests: stop filtering out bookmark output
Siddharth Agarwal <sid0@fb.com>
parents:
844
diff
changeset
|
19 $ hg -R hgrepo log --graph |
844
fffe8883960b
git_handler: mark source for rename info as Git or Mercurial
Siddharth Agarwal <sid0@fb.com>
parents:
693
diff
changeset
|
20 @ changeset: 1:7fe02317c63d |
870
93689e8f27ac
tests: stop filtering out bookmark output
Siddharth Agarwal <sid0@fb.com>
parents:
844
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 | |
844
fffe8883960b
git_handler: mark source for rename info as Git or Mercurial
Siddharth Agarwal <sid0@fb.com>
parents:
693
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 |
844
fffe8883960b
git_handler: mark source for rename info as Git or Mercurial
Siddharth Agarwal <sid0@fb.com>
parents:
693
diff
changeset
|
36 * master 1:7fe02317c63d |
693
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 |
844
fffe8883960b
git_handler: mark source for rename info as Git or Mercurial
Siddharth Agarwal <sid0@fb.com>
parents:
693
diff
changeset
|
38 verifying rev 7fe02317c63d against git commit 9497a4ee62e16ee641860d7677cdb2589ea15554 |
1042
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
39 |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
40 test for ssh vulnerability |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
41 |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
42 $ hg clone 'git+ssh://-oProxyCommand=rm${IFS}nonexistent/path' | grep -v 'destination\|pulling from' |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
43 abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent' |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
44 [1] |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
45 $ hg clone 'git+ssh://%2DoProxyCommand=rm${IFS}nonexistent/path' | grep -v 'destination\|pulling from' |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
46 abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent' |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
47 [1] |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
48 |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
49 $ hg init a |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
50 $ cd a |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
51 $ hg pull 'git+ssh://-oProxyCommand=rm${IFS}nonexistent/path' | grep -v 'destination\|pulling from' |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
52 abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent' |
b4d2180739bb
ssh: avoid SSH command-line injection [SEC]
Sean Farley <sean@farley.io>
parents:
870
diff
changeset
|
53 [1] |