summaryrefslogtreecommitdiff
path: root/caddytest/integration/caddyfile_adapt/http_only_on_domain.txt
diff options
context:
space:
mode:
authorKevin Daudt <me@ikke.info>2022-01-24 22:41:08 +0100
committerGitHub <noreply@github.com>2022-01-24 14:41:08 -0700
commit44e5e9e43f3583f04613bbbb1996e9b5a13a60ac (patch)
treeef6dca686d8f5ca2c72212c99b0c1e39c09a6b6e /caddytest/integration/caddyfile_adapt/http_only_on_domain.txt
parentbf380d00ab62ccedcf5d7f32125bfbd4dd636d01 (diff)
caddyhttp: Fix test when /tmp/etc already exists (#4544)
The TestFileListing test in tplcontext_test has one test that verifies if directory traversal is not happening. The context root is set to '/tmp' and then it tries to open '../../../../../etc', which gets normalized to '/tmp/etc'. The test then expects an error to be returned, assuming that '/tmp/etc' does not exist on the system. When it does exist, it results in a test failure: ``` --- FAIL: TestFileListing (0.00s) tplcontext_test.go:422: Test 4: Expected error but had none FAIL FAIL github.com/caddyserver/caddy/v2/modules/caddyhttp/templates 0.042s ``` Instead of using '/tmp' as root, use a dedicated directory created with `os.MkdirTemp()` instead. That way, we know that the directory is empty.
Diffstat (limited to 'caddytest/integration/caddyfile_adapt/http_only_on_domain.txt')
0 files changed, 0 insertions, 0 deletions