mirror of
https://git.zx2c4.com/cgit/
synced 2024-11-13 19:12:05 +00:00
629659d2cf
Update to git version v2.29.0, this requires changes for these upstream commits: * dbbcd44fb47347a3fdbee88ea21805b7f4ac0b98 strvec: rename files from argv-array to strvec * 873cd28a8b17ff21908c78c7929a7615f8c94992 argv-array: rename to strvec * d70a9eb611a9d242c1d26847d223b8677609305b strvec: rename struct fields * 6a67c759489e1025665adf78326e9e0d0981bab5 test-lib-functions: restrict test_must_fail usage Signed-off-by: Christian Hesse <mail@eworm.de>
49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='Ensure that git does not access $HOME'
|
|
. ./setup.sh
|
|
|
|
test -n "$(which strace 2>/dev/null)" || {
|
|
skip_all='Skipping access validation tests: strace not found'
|
|
test_done
|
|
exit
|
|
}
|
|
|
|
strace true 2>/dev/null || {
|
|
skip_all='Skipping access validation tests: strace not functional'
|
|
test_done
|
|
exit
|
|
}
|
|
|
|
test_no_home_access () {
|
|
non_existent_path="/path/to/some/place/that/does/not/possibly/exist"
|
|
while test -d "$non_existent_path"; do
|
|
non_existent_path="$non_existent_path/$(date +%N)"
|
|
done &&
|
|
strace \
|
|
-E HOME="$non_existent_path" \
|
|
-E CGIT_CONFIG="$PWD/cgitrc" \
|
|
-E QUERY_STRING="url=$1" \
|
|
-e access -f -o strace.out cgit &&
|
|
! grep "$non_existent_path" strace.out
|
|
}
|
|
|
|
test_no_home_access_success() {
|
|
test_expect_success "do not access \$HOME: $1" "
|
|
test_no_home_access '$1'
|
|
"
|
|
}
|
|
|
|
test_no_home_access_success
|
|
test_no_home_access_success foo
|
|
test_no_home_access_success foo/refs
|
|
test_no_home_access_success foo/log
|
|
test_no_home_access_success foo/tree
|
|
test_no_home_access_success foo/tree/file-1
|
|
test_no_home_access_success foo/commit
|
|
test_no_home_access_success foo/diff
|
|
test_no_home_access_success foo/patch
|
|
test_no_home_access_success foo/snapshot/master.tar.gz
|
|
|
|
test_done
|