Skip to content

fix(tests): path traversal test suite errors on Windows without symlink privilege - #230

Merged
Wolfvin merged 1 commit into
mainfrom
fix/path-traversal-test-symlink-privilege
Jul 12, 2026
Merged

fix(tests): path traversal test suite errors on Windows without symlink privilege#230
Wolfvin merged 1 commit into
mainfrom
fix/path-traversal-test-symlink-privilege

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Found during a full test suite health check — test_path_traversal.py produced 26 collection ERRORs (not failures), all from the shared project_tree fixture unconditionally calling symlink_to(), which requires elevated privilege on Windows (SeCreateSymbolicLinkPrivilege) and raises OSError WinError 1314 without it.

Since every test in the file depends on this fixture, ALL 26 errored — including tests unrelated to symlinks (e.g. test_raises_for_empty_path).

Fix: wrap symlink creation in try/except, fall back to a plain file. The ~8 tests that specifically test symlink-escape behavior check symlinks_supported and skip themselves cleanly when the platform lacks the privilege.

Before: 26 errors. After: 33 passed, 8 skipped.

@Wolfvin
Wolfvin merged commit d383e63 into main Jul 12, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Wolfvin
Wolfvin deleted the fix/path-traversal-test-symlink-privilege branch July 12, 2026 05:15
…nk privilege

All 26 tests in test_path_traversal.py depend on a shared project_tree
fixture that unconditionally calls symlink_to() twice. Creating symlinks on
Windows requires SeCreateSymbolicLinkPrivilege (Administrator or Developer
Mode) — without it, os.symlink() raises OSError WinError 1314, and since
the fixture setup fails, EVERY dependent test errors, including tests that
don't test symlink behavior at all (e.g. test_raises_for_empty_path).

Fix: wrap symlink creation in try/except OSError, falling back to a plain
file so non-symlink-specific tests still run. The fixture exposes
symlinks_supported so the ~8 tests that specifically test symlink-escape
behavior can skip themselves individually when the platform lacks the
privilege, rather than showing a spurious collection error.

Before: 26 errors (entire file uncollectable in restricted environments).
After: 33 passed, 8 skipped (symlink-specific tests skip cleanly, correctly
sourced from Known Gap: this environment lacks symlink privilege — not a
CodeLens bug).
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant