Remove legacy tool approval signature fallback in v8
Background
PR #17493 made the tool approval HMAC payload injective: it changed buildPayload in packages/ai/src/generate-text/tool-approval-signature.ts from newline-joined field concatenation to JSON.stringify with a domain-separation prefix, so distinct field tuples can no longer serialize to identical signed bytes.
Because tool approval signatures live in client-supplied message history, a pending approval signed by a pre-#17493 server could straddle an upgrade and fail verification on the new server. To avoid breaking those, verifyToolApprovalSignature keeps a legacy fallback: on a failed JSON-format check it re-verifies against the old newline-joined payload, but only when no signed field contains the \n delimiter — the exact condition that made the old format ambiguous — so the collision stays closed while benign old signatures still verify.
That fallback is deliberate scaffolding for the v7 line. In the next major we can drop it: any approval signed that long ago is no longer pending, so only the injective format needs to be accepted.
Goal (v8)
Remove the legacy newline-format verification fallback so only the injective JSON payload is accepted, and delete the compatibility code and its tests.
Tasks
- [ ]
packages/ai/src/generate-text/tool-approval-signature.ts: deletebuildLegacyPayloadand theTODO: remove in v8fallback branch inverifyToolApprovalSignature; the function should verify againstbuildPayloadonly. - [ ]
packages/ai/src/generate-text/tool-approval-signature.test.ts: remove thesignLegacyhelper and the two legacy-fallback tests (should still verify a legacy newline-format signature …andshould not accept a legacy signature through the retupling collision). Keep the injective/collision regression tests. - [ ] Add a major changeset noting that signatures produced before the injective format (pre-#17493) are no longer accepted.
References
- #17493 — injective payload + legacy fallback (this scaffolding)
Identify issue type
Identified as Feature
Confidence: High
Rationale
This is a planned breaking behavior change for the next major version, not a failure of existing behavior.
Evidence
- Requests a v8 behavior change so verification accepts only the injective JSON payload.
- Calls for removing the legacy signature fallback, compatibility tests, and adding a major changeset.
- Does not report broken or incorrect current behavior; the fallback is described as deliberate v7 compatibility scaffolding.