fix(governance): agent argument named "tool" bypasses the sensitive-tool approval gate#27
Closed
sxyrxyy wants to merge 1 commit into
Closed
Conversation
… policy gate
The action dict inspected by GovernanceLayer was built as
`{"tool": tool_name, "type": "tool_call", **tool_input}`. Spreading the
agent-supplied arguments last let an argument named `tool` overwrite the
real tool name. GOV-001 checks `action["tool"]` against the sensitive-tool
set, so a HIGH/CRITICAL agent calling e.g. `payment_execute` with an
argument `{"tool": "noop"}` read as a non-sensitive tool and skipped the
REQUIRE_APPROVAL escalation.
Spread the arguments first so the trusted `tool`/`type` fields always win.
Keeps the flat action shape (GOV-003 still reads `action["amount"]`).
sxyrxyy
force-pushed
the
fix/governance-action-tool-collision
branch
from
July 23, 2026 03:26
b462384 to
2869dfc
Compare
Author
|
Superseding with a fresh branch for a clean history. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The problem
Some tools are on a watchlist (
payment_execute,admin_api,file_delete,database_write). When an agent uses one, governance (GOV-001) is meant to stop and require human approval.The action dict it checks was built as
{"tool": tool_name, "type": "tool_call", **tool_input}. The agent's own arguments get spread in last, so an argument namedtooloverwrites the real tool name. GOV-001 then checks the fake name, sees something harmless, and skips approval.Impact: a prompt-injected agent calls
payment_executewith an argument{"tool": "noop"}and the approval gate never fires. Withenforce=Truethe dangerous tool just runs. Even in observe-only mode, the signed attestation records it asgovernance: pass, so the audit trail certifies a check that never happened. The same trick overridestype, which the type-keyed rules rely on.The fix
Spread the agent's arguments first so the trusted
tool/typefields always win:{**tool_input, "tool": tool_name, "type": "tool_call"}Keeps the flat action shape, so GOV-003 still reads
action["amount"]. The sibling decision-record paths already nest arguments safely and are unchanged.Verified
Through the real adapter path with
enforce=True: the poisoned call now resolves topayment_executeand is denied (escalate, fail-closed with no approval handler). The honest call is unchanged. Existing test suite unaffected (the async adapter tests fail identically onmainwithout this change; they needpytest-asyncio, unrelated to this fix).