test-audit-path: add more tests (issue 1450) 1.1.2
authorPeter Arrenbrecht <peter.arrenbrecht@gmail.com>
Tue, 30 Dec 2008 22:10:41 +0100
changeset 7554 11a4eb81fb4f
parent 7553 71be8688f2db
child 7555 5a6f417fa029
test-audit-path: add more tests (issue 1450)
tests/tampered.hg
tests/test-audit-path
tests/test-audit-path.out
Binary file tests/tampered.hg has changed
--- a/tests/test-audit-path	Wed Dec 31 16:27:20 2008 -0600
+++ b/tests/test-audit-path	Tue Dec 30 22:10:41 2008 +0100
@@ -20,4 +20,25 @@
 echo % should still fail - maybe
 hg add b/b
 
+echo % unbundle tampered bundle
+hg init target
+cd target
+hg unbundle $TESTDIR/tampered.hg
+
+echo % attack .hg/test
+hg manifest -r0
+hg update -Cr0
+
+echo % attack foo/.hg/test
+hg manifest -r1
+hg update -Cr1
+
+echo % attack back/test where back symlinks to ..
+hg manifest -r2
+hg update -Cr2
+
+echo % attack ../test
+hg manifest -r3
+hg update -Cr3
+
 exit 0
--- a/tests/test-audit-path.out	Wed Dec 31 16:27:20 2008 -0600
+++ b/tests/test-audit-path.out	Tue Dec 30 22:10:41 2008 +0100
@@ -6,3 +6,22 @@
 % should succeed
 % should still fail - maybe
 abort: path 'b/b' traverses symbolic link 'b'
+% unbundle tampered bundle
+adding changesets
+adding manifests
+adding file changes
+added 4 changesets with 5 changes to 5 files (+3 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+% attack .hg/test
+.hg/test
+abort: path contains illegal component: .hg/test
+% attack foo/.hg/test
+foo/.hg/test
+abort: path 'foo/.hg/test' is inside repo 'foo'
+% attack back/test where back symlinks to ..
+back
+back/test
+abort: path 'back/test' traverses symbolic link 'back'
+% attack ../test
+../test
+abort: path contains illegal component: ../test