Skip to content
Snippets Groups Projects
Commit 1f8b861b authored by Danek Duvall's avatar Danek Duvall
Browse files

tests-subrepo-git: make the "pwned" message output in a stable order

The "pwned" message from this test gets gets sent to stderr, and so may get
emitted in different places from run to run in the rest of mercurial's
output.  This patch forces the message to go to a specific file instead,
whose existence and contents we can examine at a stable point in the test's
execution.
parent b0b85d86
No related branches found
No related tags found
No related merge requests found
......@@ -1135,7 +1135,7 @@
test for Git CVE-2016-3068
$ hg init malicious-subrepository
$ cd malicious-subrepository
$ echo "s = [git]ext::sh -c echo% pwned% >&2" > .hgsub
$ echo "s = [git]ext::sh -c echo% pwned% >pwned.txt" > .hgsub
$ git init s
Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/
$ cd s
......@@ -1145,7 +1145,8 @@
$ hg add .hgsub
$ hg commit -m "add subrepo"
$ cd ..
$ rm -f pwned.txt
$ env -u GIT_ALLOW_PROTOCOL hg clone malicious-subrepository malicious-subrepository-protected
Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
fatal: transport 'ext' not allowed
updating to branch default
......@@ -1148,7 +1149,7 @@
$ env -u GIT_ALLOW_PROTOCOL hg clone malicious-subrepository malicious-subrepository-protected
Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
fatal: transport 'ext' not allowed
updating to branch default
cloning subrepo s from ext::sh -c echo% pwned% >&2
cloning subrepo s from ext::sh -c echo% pwned% >pwned.txt
abort: git clone error 128 in s (in subrepo s)
[255]
......@@ -1153,4 +1154,5 @@
abort: git clone error 128 in s (in subrepo s)
[255]
$ test -f pwned.txt && cat pwned.txt || true
whitelisting of ext should be respected (that's the git submodule behaviour)
......@@ -1155,4 +1157,5 @@
whitelisting of ext should be respected (that's the git submodule behaviour)
$ rm -f pwned.txt
$ env GIT_ALLOW_PROTOCOL=ext hg clone malicious-subrepository malicious-subrepository-clone-allowed
Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
......@@ -1157,8 +1160,7 @@
$ env GIT_ALLOW_PROTOCOL=ext hg clone malicious-subrepository malicious-subrepository-clone-allowed
Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
pwned
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
updating to branch default
......@@ -1160,8 +1162,8 @@
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
updating to branch default
cloning subrepo s from ext::sh -c echo% pwned% >&2
cloning subrepo s from ext::sh -c echo% pwned% >pwned.txt
abort: git clone error 128 in s (in subrepo s)
[255]
......@@ -1166,2 +1168,4 @@
abort: git clone error 128 in s (in subrepo s)
[255]
$ cat pwned.txt
pwned
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment