lib/checkout: Validate pathnames during checkout
While we do protect against path traversal during pull, let's also validate during checkout; it's a cheap operation and provides good last-mile protection. Closes: #1412 Approved by: jlebon
This commit is contained in:
1 parent
2b78df25f4
commit
f3ae36ff43
2 files changed
+21
-3
No files matched your search
@@ -19,7 +19,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..5"
|
||||
echo "1..6"
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
@@ -79,6 +79,11 @@ if ${CMD_PREFIX} ostree --repo=ostree-path-traverse/repo fsck -q 2>err.txt; then
|
||||
fatal "fsck unexpectedly succeeded"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt '.dirtree: Invalid / in filename ../afile'
|
||||
echo "ok path traverse fsck"
|
||||
|
||||
echo "ok path traverse"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
if ${CMD_PREFIX} ostree --repo=ostree-path-traverse/repo checkout pathtraverse-test pathtraverse-test 2>err.txt; then
|
||||
fatal "checkout with path traversal unexpectedly succeeded"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt 'Invalid / in filename ../afile'
|
||||
echo "ok path traverse checkout"
|
||||
Reference in new issue
Block a user