Skip to content

fix(audit): treat NTFS junctions in .github and docs like directory symlinks - #111

Merged
drevendev merged 1 commit into
masterfrom
beautifulrepo/audit-junctions-20261023
Oct 23, 2026
Merged

drevendev merged 1 commit into
masterfrom
beautifulrepo/audit-junctions-20261023

Conversation

@drevendev

Copy link
Copy Markdown
Owner

Reader problem and change

guides/repository-audit.md promises that directory symlinks in .github or docs are not traversed. On Windows, an NTFS junction got past that guard. Path.is_symlink() is False for a junction, so repo_audit.py listed a docs junction and read the README it pointed to, wherever that was.

  • _is_redirect uses lstat and the junction reparse tag. The inventory treats a junction like a directory symlink: path.symlink warning, not followed. The document reader rejects it as non-regular.
  • The finding message and the guide now name junctions, and the changelog has an entry.

The link-checker half of #108 (junction loops and junction targets) landed with #110.

Closes #108

Evidence

The new Windows-only test test_directory_junction_is_not_followed points a docs junction at a directory containing PRIVATE:

  • against the old code it fails ('path.symlink' not found in []);
  • with the fix it passes, PRIVATE stays out of the report, and docs/README.md stays out of read_files.

Verification

  • The five local checks passed on Windows 11 with Python 3.14.7: catalog OK; docs links 194; HTML navigation 205; 263 tests OK, 7 skipped; repo audit 0 findings.
  • The junction test runs on the Windows CI job. It is skipped on Linux, where junctions don't exist.
  • Accessibility and visual checks: not applicable.

Limitations

  • Git checkouts can't create junctions, so this matters for local directories, unpacked archives and trees prepared by other tools.
  • Like the existing symlink checks, this assumes a stable checkout, not one being changed concurrently.

🤖 Generated with Claude Code

…ymlinks

repo_audit.py checked only Path.is_symlink(), which is False for an NTFS
junction. A junction named docs or .github was therefore listed and its
documents were read from wherever it pointed, contrary to the documented
"directory symlinks are not traversed" guarantee. Both the inventory and the
document reader now use lstat and the junction reparse tag, so a junction is
reported as path.symlink and never read through.

The link-checker half of #108 landed with #110.

Closes #108

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@drevendev
drevendev force-pushed the beautifulrepo/audit-junctions-20261023 branch from a183c14 to 7029649 Compare October 23, 2026 07:36
@drevendev
drevendev merged commit 7e487cf into master Oct 23, 2026
5 checks passed
@drevendev
drevendev deleted the beautifulrepo/audit-junctions-20261023 branch October 23, 2026 07:38
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.

Windows junctions get past the symlink guards and can loop the link-checker walk

1 participant