Skip to content

Commit f2c0626

Browse files
committed
fix(ci): suppress ruff S108 for test paths and use tempfile.gettempdir()
Pre-commit.ci flagged /tmp literals in test assertions as S108 (insecure temp path). These are test-only strings used to verify path traversal rejection, not actual temp file usage. Signed-off-by: Yash Goel <yashhzd@users.noreply.github.com>
1 parent 2dc8ee5 commit f2c0626

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_backend_filesystem.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ def test_download_rejects_absolute_path(self, tmp_path) -> None:
10531053
str(tmp_path), "vehicle_type", None, allow_editing_template_files=False, save_component_to_system_templates=False
10541054
)
10551055
lfs.configuration_steps = {
1056-
"test.param": {"download_file": {"source_url": "https://example.com/payload", "dest_local": "/tmp/evil"}}
1056+
"test.param": {"download_file": {"source_url": "https://example.com/payload", "dest_local": "/tmp/evil"}} # noqa: S108
10571057
}
10581058

10591059
with pytest.raises(ValueError, match="Path escapes vehicle directory"):
@@ -1085,10 +1085,10 @@ def test_download_rejects_symlink_escape(self, tmp_path) -> None:
10851085
WHEN: dest_local references a file through the symlink
10861086
THEN: A ValueError is raised because the resolved path escapes vehicle_dir
10871087
"""
1088-
# Create a symlink inside tmp_path pointing to /tmp
1088+
# Create a symlink inside tmp_path pointing outside vehicle_dir
10891089
symlink_path = tmp_path / "escape_link"
10901090
try:
1091-
symlink_path.symlink_to("/tmp")
1091+
symlink_path.symlink_to(tempfile.gettempdir())
10921092
except OSError:
10931093
pytest.skip("Cannot create symlinks in this environment")
10941094

0 commit comments

Comments
 (0)