fix(approvals): protect persisted security decisions - #21
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements write protection for the Hermes approval state file (approval_requests.json) to prevent agents from forging resolved requests and bypassing terminal approval gates. The changes include adding regex patterns to block direct writes, copies, and in-place edits, as well as path checks and corresponding tests. The review feedback highlights two critical security concerns: first, the current patterns do not block the creation of symlinks (e.g., via ln) targeting sensitive paths, which could allow an agent to bypass the write protection; second, path resolution mismatches in containerized environments could bypass the strict string comparison check, requiring a more robust path comparison approach.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7530c744e4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Code Review Roast 🔥Verdict: No Issues Found | Recommendation: Merge The cp-link bypass is closed. The new pattern at Files Reviewed (2 files changed in increment)
Ponytail review:
Ponytail net: 0 lines. Final Merge Guidance: Can merge as-is. The cp-link regex nitpick is optional cleanup. Previous Review Summaries (3 snapshots, latest commit 2ae9a8c)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 2ae9a8c)Verdict: No Issues Found | Recommendation: Merge Oh wait, this incremental commit is actually clean. I had my torch primed for a leftover stash of description rot and symlink-source edge cases, and the diff disarmed every one of them. 📊 Overall: Two surgical regex edits plus three regression tests — like watching a surgeon close one wound, drop the scalpel, and walk out without leaving a suture kit on the tray. The previously-flagged Files Reviewed (2 files changed in increment)
Previous review (commit 3a7f637)Verdict: 1 Issue Found | Recommendation: Optional nitpick; safe to merge as-is Overview
Issue Details (click to expand)
🏆 Best part: Both previous Kilo nitpicks AND the three external findings (Gemini symlink bypass, Gemini container-path mismatch, Codex profile-qualified path) are all explicitly fixed in this single follow-up commit with surgical diffs — author even left breadcrumb replies on every thread pointing to 💀 Worst part: The 📊 Overall: The hard parts — closing the symlink bypass, making Files Reviewed (4 files)
Correctness / Safety FindingsNo correctness or safety findings. The Ponytail Review
Otherwise: the optional Ponytail net: 0 lines. Suggested Minimal Patch
Final Merge GuidanceCan merge. The single nitpick is a description-string consistency issue; the security behavior is correct on current Fix these issues in Kilo Cloud Previous review (commit 7530c74)Verdict: 2 Issues Found | Recommendation: Approve (optional polish) Overview
Issue Details (click to expand)
🏆 Best part: The fix is small, surgical, and uses the existing pattern plumbing — a new 💀 Worst part: The 📊 Overall: A focused, well-tested security follow-up that adds ~59 lines and removes a real attack surface. The two findings are polish — leave them if you want to ship, fix them if you're already in the file. Files Reviewed (4 files)
Correctness / Safety FindingsNo correctness or safety findings. The new pattern is correctly included in Ponytail Review
Otherwise: the new regex Ponytail net: 0 lines. Suggested Minimal Patch
Final Merge GuidanceCan merge. Both findings are polish — the security behavior is correct on current Reviewed by minimax-m3 · Input: 53.8K · Output: 14.9K · Cached: 569K |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a7f637b97
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2ae9a8cfad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Protect persisted approval outcomes from agent writes
Follow-up to #17 after an adversarial post-merge review.
Security issue
approval_requests.jsoncontains persisted terminal approval outcomes. The ordinarywrite_file/patchsurfaces previously allowed the agent to replace that file, and terminal redirection/in-place edits did not classify it as a sensitive write target. A forged resolved record with a matching session and argument hash could therefore bypass the intended approval gate.Fix
write_fileandpatchwrites to default, profile-qualified, container, and Windows approval-state pathstee,cp/mv/install, symlinks,sed -i, andperl/ruby -iwrites to that state file as approval-requiring terminal operations~/.hermes,$HERMES_HOME, profile-qualified, and resolved absolute active-home formsVerification
git diff --checkpasses.