diff tests/test-subrepo-git.t @ 29328:60621cecc8c5

merge with stable
author Matt Mackall <mpm@selenic.com>
date Thu, 09 Jun 2016 13:47:42 -0500
parents 3879d02cd1cc 9b4f0ad02f51
children a145161debed
line wrap: on
line diff
--- a/tests/test-subrepo-git.t	Tue Jun 07 11:57:11 2016 +0200
+++ b/tests/test-subrepo-git.t	Thu Jun 09 13:47:42 2016 -0500
@@ -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_MSG% >pwned.txt" > .hgsub
   $ git init s
   Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/
   $ cd s
@@ -1145,24 +1145,31 @@
   $ hg add .hgsub
   $ hg commit -m "add subrepo"
   $ cd ..
+  $ rm -f pwned.txt
   $ unset GIT_ALLOW_PROTOCOL
-  $ hg clone malicious-subrepository malicious-subrepository-protected
+  $ PWNED_MSG="your git is too old or mercurial has regressed" 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_MSG% >pwned.txt
   abort: git clone error 128 in s (in subrepo s)
   [255]
+  $ f -Dq pwned.txt
+  pwned.txt: file not found
 
 whitelisting of ext should be respected (that's the git submodule behaviour)
-  $ env GIT_ALLOW_PROTOCOL=ext hg clone malicious-subrepository malicious-subrepository-clone-allowed
+  $ rm -f pwned.txt
+  $ env GIT_ALLOW_PROTOCOL=ext PWNED_MSG="you asked for it" 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
-  cloning subrepo s from ext::sh -c echo% pwned% >&2
+  cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt
   abort: git clone error 128 in s (in subrepo s)
   [255]
+  $ f -Dq pwned.txt
+  pwned: you asked for it