Skip to content

Reject Windows drive-lettered and colon-bearing Gitlink paths#95

Merged
dovvnloading merged 1 commit into
mainfrom
hotfix/gitlink-drive-letter-path-rejection
Jul 22, 2026
Merged

Reject Windows drive-lettered and colon-bearing Gitlink paths#95
dovvnloading merged 1 commit into
mainfrom
hotfix/gitlink-drive-letter-path-rejection

Conversation

@dovvnloading

Copy link
Copy Markdown
Owner

Summary

_normalize_repo_path's absolute-path guard (audit finding B1) checks PurePosixPath.is_absolute(), which doesn't recognize a Windows drive letter as absolute (no leading /). So a drive-lettered path slipped past it — not a real escape (_safe_local_target's resolve()+containment check still catches a genuine cross-drive path), but silent aliasing: Windows pathlib treats a same-drive "C:" path segment as a no-op drive-relative reference rather than a literal folder, so an LLM-proposed "C:/config/app.txt" resolved to the exact same target as the plain "config/app.txt" — not rejected as "absolute-looking input" the way this guard's own contract says it should be.

Fix

Reject any ':' in a path segment loudly instead of letting it collapse silently — covers same-drive and cross-drive letters, the slash-less drive-relative form ("C:app.txt"), and an NTFS Alternate Data Stream marker as a bonus (ADS addressing doesn't actually work through this path-join code path, but rejecting it is free and consistent with the rest of this guard's defensive stance).

Test plan

  • Updated the one existing test that had pinned the old "silently contained" behavior to instead assert rejection
  • Added coverage for every variant: same-drive, cross-drive, slash-less drive-relative, ADS-style, and a colon deeper in the path
  • Full suite: 1710 passed, zero regressions

Fifth and final fix from the recent adversarial bug-scan (after #91, #92, #93, #94) — worklist complete.

_normalize_repo_path's absolute-path guard (audit finding B1) checks
PurePosixPath.is_absolute(), which doesn't recognize a Windows drive
letter as absolute (no leading '/'). So a drive-lettered path slipped
past it - not a real escape (_safe_local_target's resolve()+containment
check still catches a genuine cross-drive path), but silent aliasing:
Windows pathlib treats a same-drive "C:" path segment as a no-op
drive-relative reference rather than a literal folder, so an
LLM-proposed "C:/config/app.txt" resolved to the exact same target as
the plain "config/app.txt" - not rejected as "absolute-looking input"
the way this guard's own contract says it should be.

Reject any ':' in a path segment loudly instead of letting it collapse
silently - covers same-drive and cross-drive letters, the
slash-less drive-relative form ("C:app.txt"), and an NTFS Alternate
Data Stream marker as a bonus (ADS addressing doesn't actually work
through this path-join code path, but rejecting it is free and
consistent with the rest of this guard's defensive stance).

Updated the one existing test that had pinned the old "silently
contained" behavior to instead assert rejection, and added coverage for
every variant found above. Full suite 1710 passed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dovvnloading
dovvnloading merged commit d3c3dd3 into main Jul 22, 2026
2 checks passed
@dovvnloading
dovvnloading deleted the hotfix/gitlink-drive-letter-path-rejection branch July 22, 2026 02:11
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