@ai-sdk/policy-opa
1.0.177 · 18 Nov 2026Apache-2.025.7k / weekRepositoryHomepagenpmAtom feed
1.0.177 is the newest release of 1.x.
In short
2 fixed1 internal
Release note
Patch Changes
Use own-property checks when resolving per-tool approvals so tool names and approval ids that match inherited object properties (e.g.
constructor,toString,valueOf,__proto__) are treated as unconfigured/absent.@ai-sdk/policy-opa:wrapMcpToolsbuilds its per-tool map with a null prototype and reads supplied approvals via an own-property check, andshadowguards its per-tool map lookup the same way.ai: tool and tool-context lookups keyed by a model- or client-supplied name now go through an own-property check (getOwn), so a name matching an inherited object property resolves to "no such tool"/"unconfigured" instead of a prototype value. This covers the approval path (per-tool approval resolution and replay re-validation) as well as tool-call parsing, execution, streaming callbacks, and UI message conversion/validation. The human-in-the-loop approval matching (collectToolApprovals) and streaming tool-name maps are built with a null prototype so a client-supplied id that matches an inherited property no longer slips past the "unknown approval" / "tool call not found" guards.
wrapMcpTools: per-tool approval functions now fail closed. In the per-tool map form, a per-tool approval function that returns a "no opinion" result (not-applicableorundefined) is now forced through the configured fallback (user-approvalby default), matching the generic-function form. Previously such a result passed through and the tool resolved tonot-applicable, letting it run without an approval request. Static per-tool statuses the caller configured explicitly are unchanged.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.