From 751239250f82ada7234eb68cf5415d1448f77677 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 7 Nov 2024 19:41:48 +0100 Subject: [PATCH] Security check - improve test --- changedetectionio/tests/test_security.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/changedetectionio/tests/test_security.py b/changedetectionio/tests/test_security.py index 5bb9e879dc4..71970f964ca 100644 --- a/changedetectionio/tests/test_security.py +++ b/changedetectionio/tests/test_security.py @@ -64,7 +64,7 @@ def test_bad_access(client, live_server, measure_memory_usage): def test_file_slashslash_access(client, live_server, measure_memory_usage): #live_server_setup(live_server) - test_file_path = "/tmp/test-file.txt" + test_file_path = os.path.abspath(__file__) # file:// is permitted by default, but it will be caught by ALLOW_FILE_URI client.post( @@ -82,8 +82,7 @@ def test_file_slashslash_access(client, live_server, measure_memory_usage): follow_redirects=True ) - # Should see something (this file added by run_basic_tests.sh) - assert b"Hello world" in res.data + assert b"test_file_slashslash_access" in res.data else: # Default should be here assert b'file:// type access is denied for security reasons.' in res.data @@ -109,8 +108,7 @@ def test_file_slash_access(client, live_server, measure_memory_usage): follow_redirects=True ) - # Should see something (this file added by run_basic_tests.sh) - assert b"Hello world" in res.data + assert b"test_file_slash_access" in res.data else: # Default should be here assert b'file:// type access is denied for security reasons.' in res.data