fix(hooks): restrict MultiEdit AI-reviewed marker source - #339
Open
atomicdjt wants to merge 1 commit into
Open
Conversation
Signed-off-by: David Turner <davidelsey9513@gmail.com>
Contributor
Rosetta Triage ReviewSummary: Fixes a security bypass in the Findings:
Caveats:
Automated triage by Rosetta agent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Editaccepts theRosetta-AI-reviewedoverride marker only fromnew_string, butMultiEditpreviously scanned every property of eachedits[]object. A marker inold_stringor another property could therefore satisfy the reconsider-deny override without appearing in content being written.Root cause
hasAIReviewedMarkerusedObject.values(item)for object entries in array-valued marker fields.MARKER_FIELDS_BY_TOOLidentifiesMultiEdit.editsas the relevant top-level field, but the nested traversal did not enforce the same write-field boundary as plainEdit.Fix
For
MultiEdit, marker detection now checks only each edit item's stringnew_string. The existing behavior for plainEdit, MCP marker fields, and other array-shaped inputs is unchanged.This is a focused defense-in-depth correctness fix; it does not change the marker string or redesign dangerous-action policy.
Regression coverage
MultiEdit.edits[].old_stringremains denied;MultiEdit.edits[].new_stringremains accepted;Editpositive and old-string negative cases remain green;Verification
npx tsc— passed;npx vitest run tests/dangerous-actions.test.ts— 198 passed;npx vitest run tests/regression/bundle-isolation.test.tsafter bundle build — 193 passed;npm run check— passed;git diff --check— passed;tscplusbuild-bundles.mjs) — passed;build:quietand pre-commit wrapper cannot complete on this Windows host because their Unixrmcommand is not available; the TypeScript and bundle stages succeeded directly.Fixes #210
Codex assisted with repository analysis, implementation, regression tests, and validation. I directed the scope and reviewed the final diff and PR text.