Repository navigation
Keep a __proto__ key as data when cutting a tool-call log excerpt - #1469
Merged
Merged
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
boundPayload()copies a large tool response into a smaller excerpt for thetool_invocationslog. It wrote every key into a plain{}, so a vendor field named__proto__(whichJSON.parsecreates as an ordinary own property) replaced the excerpt object's prototype instead of being stored. The global prototype was never reachable, but the field was lost and code scanning flagged it as remote property injection.Changes
packages/backend/src/audit/bound-payload.ts: the excerpt objects are created withObject.create(null), so every key,__proto__included, is stored as data.bound-payload.spec.ts: new case with a__proto__field in a cut response. It fails without the fix.Type
Testing
cd packages/backend && npx jest src/audit/bound-payload.spec.ts: 7 passed (the new case fails on main: 1 failed, 6 passed).Checklist
Deployment
Same behaviour in Cloud and self-hosted: only the stored log excerpt changes. JSON serialization of the excerpt is unchanged.
Related Issues
Code scanning alert 624.