Skip to content

Protect Codex advice state from redirected writes (T5) - #125

Merged
erickb336 merged 7 commits into
mainfrom
codex/t5-private-advice
Oct 12, 2026
Merged

erickb336 merged 7 commits into
mainfrom
codex/t5-private-advice

Conversation

@erickb336

Copy link
Copy Markdown
Owner

Closes #95
Sage task T5 (Codex logbook)

Codex advice state now lives in a private directory under CODEX_HOME by default. The hook refuses linked, foreign-owned, or unsafe directories. It opens existing state without following links and writes a private temporary file before an atomic rename. A preplaced state-file link no longer redirects the write to its target.

Reviewed head: 4b4a7e6. Base: main e8b823d (#75 merged).

Validation

All test commands used fake ps, pgrep, and kill first on PATH.

Command Last result
npm run build built 236 files
npm run check all checks pass
npm test tests 876; pass 876; fail 0; skipped 0
node --test --test-name-pattern='Codex advice' scripts/providers.test.mjs tests 3; pass 3; fail 0
Same focused command on detached main e8b823d tests 3; pass 0; fail 3
git diff --check Exit 0

Only the tests were copied into the detached main checkout. The three baseline failures show linked-directory refusal, the private default location, and foreign-ancestor refusal missing on main. Tests also verify that the linked destination retains its original content, replacement state has mode 0600, private directories have mode 0700, and repeat advice is deduplicated.

Independent code, security, and QA reviews returned no actionable findings on this exact head. Reviewers checked the source, bundled copy, test cases, and recorded evidence; they did not rerun the full suite. QA verified the unchanged assertions and behavioral baseline failures. The final full suite passed on this exact head.

Not verified: an actual second OS user, ACL-specific permissions, simultaneous filesystem replacement, special-file corruption, or crash durability. Foreign UID tests simulate stat ownership. Atomic replacement does not serialize concurrent advice updates. No installed automatic Sage or runtime activation is claimed.

All test and review processes exited. No process signals were sent.

@erickb336
erickb336 merged commit bb9a7ab into main Oct 12, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex advice hook: keep its state where another user cannot redirect it

1 participant