Repository navigation
feat(agent): confirmation groundwork: whole arguments, digest, pinned address (#4291, 1/3) - #4318
Merged
Merged
Conversation
…use the confirmed address (#4291) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mstomar125
force-pushed
the
issue-4291-confirm-agent
branch
from
November 20, 2026 06:56
0eefed6 to
a470265
Compare
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.
Part 1 of 3 of the remote-tool confirmation wiring (#4291; user ruling 2026-11-20: the confirmation is an in-chat card). This PR is the agent-side security groundwork. It adds no UI and installs no confirmer, so it is inert: nothing is offered to the model that was not offered before.
Agent lane. This touches
packages/agent(Michael's lane). The user's sign-off for the #4291 remote-tool build stands in for Michael's.Plan for the other two (each independently mergeable): PR 2 daemon
CallConfirmer+ pending-request map + answer RPC (tested with a fake UI, still not installed on a turn); PR 3 the card (message part, frontend) and installing the confirmer on interactive turns only. The enable-and-approve command stays a separate later PR.What this adds (requirements (a), (b), (f) from the #4315 review)
RemoteToolRunner::confirmationreturns the text AND aResolvedPin { host, address }; the host passes it torun_pinned. The REST runner and the HTTP side of the MCP runner implement it with aFixedResolverthat answers only the confirmed host with the confirmed address, and the address policy still runs on it. A name that rebinds between the question and the call is not followed (test: loopback for the question, a private address after; the run reaches the server and the resolver was asked once). A pin for another host resolves nothing. stdio and cli have nothing to pin.ConfirmationRequestnow carries the wholearguments_json, its real sizearguments_bytes, and adigest= SHA-256(text, 0x00, arguments_json) that an answer will be bound to (PR 2). A call whose arguments exceedMAX_CONFIRMED_ARGUMENT_BYTES(16 KiB; the card shows them whole) is refused before the user is asked. The runners' own text may still cut what arguments turn into (a long path or body); the whole arguments are in the request and the card shows them in full.envsecret reference or theauthsecret changes the approval tag, so a secret swapped between the question and the run is caught by the existing post-confirmation re-check.is_unsafe_for_logalso replaces U+2028/2029, U+200B-200D, U+2060, U+FEFF, the tag block U+E0000-E007F and variation selectors U+FE00-FE0F.Tests and mutants
New tests: request carries whole arguments, size and a digest that moves with either part; over-cap arguments refused before the confirmer; a call runs with the confirmation's pin (and not through the plain
run); REST and MCP-HTTP rebinding; wrong-host pin; invisible characters. Mutants (one batch, 13): digest ignores the text, digest ignores the arguments, cap removed, pin not used, size field wrong, REST and MCP runners ignore the pin, FixedResolver accepts any host, REST and MCP confirmation returns no pin, and three character-class cuts. Each is killed by a named test. (agent_loop::a_built_in_tools_result_is_unchangedis a pre-existing flake undercargo test, it passes under nextest, and shows up in the failure lists of some runs.)🤖 Generated with Claude Code