Skip to content

feat(agent): confirmation groundwork: whole arguments, digest, pinned address (#4291, 1/3) - #4318

Merged
mstomar125 merged 1 commit into
mainfrom
issue-4291-confirm-agent
Nov 20, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-4291-confirm-agent

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

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)

  • (a) Pin the resolved address. RemoteToolRunner::confirmation returns the text AND a ResolvedPin { host, address }; the host passes it to run_pinned. The REST runner and the HTTP side of the MCP runner implement it with a FixedResolver that 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.
  • (b) The user must not confirm what they did not see. ConfirmationRequest now carries the whole arguments_json, its real size arguments_bytes, and a digest = SHA-256(text, 0x00, arguments_json) that an answer will be bound to (PR 2). A call whose arguments exceed MAX_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.
  • (f) The approval covers credential references. Verified, and now pinned by a core test: editing only an env secret reference or the auth secret changes the approval tag, so a secret swapped between the question and the run is caught by the existing post-confirmation re-check.
  • Log hardening from review of feat(agent): skill tool_whitelist may name a remote tool (#4291) #4315: is_unsafe_for_log also 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_unchanged is a pre-existing flake under cargo test, it passes under nextest, and shows up in the failure lists of some runs.)

🤖 Generated with Claude Code

…use the confirmed address (#4291)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant