Vibeleaderboard
← All Intel
Intel / repo

ai ai@7.0.178

Source
github.com
Author
github-actions[bot]Top Viber
Date

Context

Version 7.0.178 of `ai`, the core package of Vercel's AI SDK for building AI applications in TypeScript, closes a way for a client to run a tool call that the app's approval policy had already refused (release notes). The bug affects only apps that set `experimental_toolApprovalSecret`, and those apps also need to rotate that secret to be fully covered.

Tool approval lets an app stop before the model's chosen tool runs, so a person can approve it or a policy can decide, and a policy can deny a call automatically. The SDK's tool approval documentation explains the risk the secret addresses. A server that keeps no conversation state receives the message history from the client on every request, so the history is client-controlled input, and a client could write in an approval that no one gave. With `experimental_toolApprovalSecret` set, the server signs each approval request with the secret when it issues it, binding it to the tool name, tool call ID and input, and accepts only approvals that carry a valid signature.

The flaw, according to the fix's commit, is that `generateText` and `streamText` also signed the approval requests of calls the policy had denied automatically, and the signature does not cover the decision. The server checks the policy again, but against the history the client sends, so a client could return that signed request with an approved response, leave out the messages that led to the denial, and have the denied tool run. Vercel's own security review reported it. Approval requests for automatic denials are now left unsigned, and an approved response to one is rejected with `AI_InvalidToolApprovalSignatureError`. Signatures that earlier versions issued for automatic denials remain valid, though, so the release notes say to rotate the secret to invalidate them. Approval requests still waiting for a user's decision then have to be issued again.

The release's other changes are smaller. When `prepareStep` returned the same messages array for several steps, tool approval functions could not tell one model response's tool calls from another's, and each step now gets its own copy. `streamText` now marks preliminary results from tools that run on the provider's side, such as OpenAI image generation previews, so they are no longer recorded as final, and file URLs are removed from download errors sent to telemetry.

Key takeaways · AI-distilled
  • Security fix: with experimental_toolApprovalSecret set, earlier versions signed approval requests for tool calls the policy had auto-denied, so a client controlling message history could resubmit them as approved and run the denied call. Those are no longer signed.
  • Signatures already issued for auto-denied calls by earlier versions remain valid; the release notes say to rotate the experimental_toolApprovalSecret to invalidate them, which also forces pending approval requests to be requested again.
  • generateText and streamText now copy the messages array prepareStep returns for each step, because reusing one array across steps left tool approval functions unable to tell which model response a tool call came from.
More from github-actions[bot]
Recommended reads
Comments

Checking sign-in…

Loading comments…