Skip to content

Keep a __proto__ key as data when cutting a tool-call log excerpt - #1469

Merged
helpcodeai merged 5 commits into
mainfrom
fix/bound-payload-proto
Nov 3, 2026
Merged

helpcodeai merged 5 commits into
mainfrom
fix/bound-payload-proto

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

boundPayload() copies a large tool response into a smaller excerpt for the tool_invocations log. It wrote every key into a plain {}, so a vendor field named __proto__ (which JSON.parse creates 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 with Object.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

  • Bug fix

Testing

  • Added/updated unit tests
  • cd packages/backend && npx jest src/audit/bound-payload.spec.ts: 7 passed (the new case fails on main: 1 failed, 6 passed).

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • All existing tests pass (CI runs the full suite)
  • This PR has a descriptive title

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.

@helpcodeai
helpcodeai merged commit f2a755b into main Nov 3, 2026
14 checks passed
@helpcodeai
helpcodeai deleted the fix/bound-payload-proto branch November 3, 2026 10:19
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant