Skip to content

Cite symlink targets and reject aliases into .git - #36

Merged
jacobprall merged 3 commits into
mainfrom
codex/issue-24-symlink-citation-integrity
Oct 28, 2026
Merged

jacobprall merged 3 commits into
mainfrom
codex/issue-24-symlink-citation-integrity

Conversation

@starmorph

@starmorph starmorph commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

The citation validator followed a symlink to check the file and line range, but kept the alias path. The evidence link could then point at different content than what was checked, and an alias into .git got past the metadata check.

inspectFile now records the symlink target's path relative to the repository root and rejects targets inside .git.

The original version of this PR read Git objects (ls-tree, cat-file) from the runner to validate against the manifest-commit blob. That was trimmed: snapshot checkouts are clean, read-only, and detached at the manifest commit, so the file on disk is the cited blob. Not spawning git from the key-holding runner is a small bonus.

Tests cover contained aliases (file, chain, directory, nested directory), aliases into .git, escaping, dangling, and cyclic links, and the evidence URL built from the target path.

Runner change: takes effect after the next snapshot refresh.

Fixes #24.

starmorph and others added 3 commits October 27, 2026 10:10
Snapshot checkouts are clean, read-only, and detached at the manifest commit,
so the file on disk is the cited blob. Resolving the symlink, recording the
target path, and re-checking .git on that path closes both alias cases from
the issue without spawning git from the key-holding runner.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jacobprall jacobprall changed the title Canonicalize citations to tracked source blobs Cite symlink targets and reject aliases into .git Oct 28, 2026
@jacobprall
jacobprall merged commit 1ba0cb4 into main Oct 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[P2] Validate symlink citations against the tracked content they reference

2 participants