Repository navigation
feat(agent): skill tool_whitelist may name a remote tool (#4291) - #4315
Merged
Merged
Conversation
…turn time (#4291) A whitelist only narrows what the gate offers; names that match nothing are reported once per turn (names only). Save-time accepts any name. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…g and case sensitivity (#4291) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mstomar125
force-pushed
the
issue-4291-whitelist
branch
from
November 20, 2026 06:01
21289fe to
25e7f6c
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 of #4291. User ruling on O3 (2026-11-20): a skill's
tool_whitelistMAY name a remote tool by its node name, checked at turn time.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.What changed
The surface was already built so that a whitelist can only narrow what the gate offers:
stage2_scoped_toolsfilters the executor's offered tools (all) by the matched skills' whitelist names, and the remote-tool host only puts a tool inallwhen it is enabled, its device approval verifies, a runner exists and (if its calls need confirmation) a confirmer is installed. So naming a remote tool needs no new path, and a whitelist can never make a tool available that the gate would not offer. What this PR adds is the visibility and the pinning tests.typed_flat_updates_test.rs).routing::unavailable_whitelist_warningfinds names in the matched skills' whitelists that are neither on the offered surface nor built-in tools (a remote tool that is unknown, disabled, not approved here, changed since approval, a name twin, or has no runner/confirmer). The agent loop logs ONEwarn!per turn with the names only (max 10 shown, each cut to 64 bytes, "and N more"); no description, schema or arguments. Those names simply match nothing, as before.Tests (host + routing, over a real database)
built-in + approved remote offered and nothing else; unapproved remote not offered with the exact warning text; a peer-authored skill naming an unapproved tool: not offered, call refused as unknown, and offered once this device approves it; disabled tool not offered; binding changed after approval (hash mismatch) not offered; no confirmer: not offered; remote tool named like a built-in: the built-in is the one offered, no warning; two approved tools with one name: not offered; empty whitelist does not narrow; warning is names only and bounded.
Mutants: whitelist adds names the gate does not offer (bypass), whitelist offers the whole list, warning includes extra data, warning reports built-ins, warning bound removed, warning not logged. See the report for which tests killed which.
Requirements for the confirmation wiring (from review; for the later PR)
(a) DNS rebinding. The name resolved for the question must be PINNED and reused by the run (pass the resolved addresses into
run), or the post-confirm check must compare the resolved IPs. Today the host rechecks onlynode_idandapproval_tagafter a yes.(b) Args vs display. Runners cut the arguments in the 4096-byte text but run with the full arguments. The user must not confirm text they did not see: bind the answer to a DIGEST of the full arguments and show the real size with an expander, or refuse calls whose arguments exceed the display cap.
(c) Answer channel unreachable by the model and its tools. UI IPC only; no localhost HTTP route or token a spawned tool could reach; accept answers only from the session's own client. Never install the confirmer on a turn with no interactive UI (scheduled, headless): otherwise cli/mcp tools would be offered with an unauthenticated answer path.
(d) Replay. A random unguessable request id bound to session, turn, tool name and arguments digest; single use; cleared at turn end. Several calls in one tool-loop iteration are id-tagged so one yes cannot cover two.
(e) Display spoofing. Destination and arguments are attacker-influenced: show plain text, escape control and bidi characters, and carry the credential line as a separate structured field, never parsed from text.
(f) Credential references in the approval tag. Confirm the approval tag covers the credential references, so a secret edited between confirm and run is caught.
(g) Timeout ordering. A timeout drops the pending entry BEFORE a late yes can arrive. "Always allow" stays out.
Follow-up filed: #4316 (
RemoteToolHost::executechecks the gate but not the turn's scoped surface, so a call to an approved remote tool that this turn's whitelist scoped out still runs after confirmation; proposal: refuse calls to tools not in the turn's offered list).Review round 1 fixes
\n, ESC, NUL and bidi overrides.log_unavailable_whitelist; a test captures the log: exactly one WARN line, names only, no control characters. Removing thewarn!now fails that test.R_GET/Get_Nodeagainst approvedr_getare not offered and are warned about.Remaining: confirmation wiring (plan, no code yet)
Today
RemoteToolHostasks aCallConfirmer(confirm(&ConfirmationRequest) -> bool) insideexecute, after the runner builds the text (confirmation_text, which may resolve the host first) and before the run; after a yes it re-checks the approval tag. The daemon installs no confirmer, so every cli/mcp tool and every non-GET (or credentialed GET) rest tool is not offered.CallConfirmerimplementation in the daemon (local_agent_service.rs, where the host is built per turn), holding a channel to the chat UI. The existing delete confirmation uses a different shape (the turn ends and the next user message answers,deletion_confirmation.rs). A remote call must be answered mid-turn, so it needs an in-turn question: emit a confirmation event to the session's stream and await the reply for that request id.ConfirmationRequestalready has tool name, kind, the runner'sdestinationtext and the arguments. Add a request id (so a late or replayed answer cannot confirm another call), the session/turn id, and structured parts alongside the text (credential references, program/origin) so the UI can render credentials as their own always-visible line rather than parsing text.Needs a decision before coding: whether the question appears as a chat message the user answers in place (consistent with deletes) or as a modal; the in-turn await works with either.
🤖 Generated with Claude Code