codex-plugin-cc icon indicating copy to clipboard operation
codex-plugin-cc copied to clipboard

adversarial-review inlines untracked files through symlinks, including files outside the repository

Open brazos-analyst opened this issue 1 month ago • 0 comments

Plugin 1.0.6 (db52e28). This is finding 1 of #597, which was closed as not planned together with unrelated items; filing it alone because it decides what leaves the machine.

formatUntrackedFile (plugins/codex/scripts/lib/git.mjs, lines 197-223) uses fs.statSync and fs.readFileSync, which follow symlinks, and inlines any text file up to 24 KB into the adversarial-review prompt. The includeDiff: false branch (lines 241-251) still builds untrackedBody from full contents, so the 2-file inline limit does not limit untracked files. Only files excluded by --exclude-standard are skipped.

Reproduced offline by calling the plugin's own resolveReviewTarget and collectReviewContext on a repository with one tracked change, an untracked symlink notes.txt -> ../outside/canary.txt, and an untracked, non-ignored text file holding a fake token: both the canary text and the token appear in context.content, with inputMode: self-collect (4 files).

Suggested fix: lstat and skip symlinks and non-regular files; optionally skip credential-shaped names (.env*, *.pem, *.p12, *.key, .netrc, .npmrc); and add a regression test with a link to a file outside the repository.

brazos-analyst avatar Oct 28 '26 00:10 brazos-analyst