Repository navigation
feat: approve a remote tool on this device, confirmed at the screen (nodespace tool approve, DescribeToolApproval/ApproveTool); credential changes confirmed too (#4291) - #4325
Merged
Conversation
Contributor
Author
|
Merge queue: #4325 was taken out of the queue — the merge gate failed on it, on top of main. Reproduce by merging or rebasing |
… DescribeToolApproval/ApproveTool); peer gate on credential changes (#4291) - agent: tool_approval module. preview() returns the name, kind, description, every binding bucket, the parameter schema and the credential references with a digest, writes nothing and creates no key; approve() re-reads the node, refuses a digest it no longer produces, provisions the device key and writes enabled + approved_binding (the existing HMAC tag via remote_tools::approve), version-checked. - core: SecretBackend::add_if_absent, never replacing an item (macOS: SecKeychainAddGenericPassword, duplicate = present; Windows: read then write; default refuses). provision_approval_key writes the key with it. - daemon: DescribeToolApproval (ungated) and ApproveTool (peer gate before routing); SecretService Set/Delete behind the same SpawnedProcessGate on unix, a refused Set wipes its value; peer_pid/peer_allowed shared in remote_confirmation; the turn's remote-tool host uses the service's SecretStore. - cli: `nodespace tool approve <node-id>` shows the escaped preview and approves only after the exact name is typed; refuses without a terminal before contacting the daemon; refused by the MCP passthrough. - skill: CLI reference regenerated, with an "Approve a remote tool" note. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…roval preview (#4291) - behaviors::end_approval_unless_enabled, run in rebucket_and_validate_behaviors after validation: every write that leaves a tool's `enabled` anything but true removes `approved_binding`, so turning a tool off and on again needs a new approval. The tag formula is unchanged. - SecretBackend::has_add_only_write. SecretStore::approval_key and provision_approval_key take no lock, and a backend without an add-only write is neither provisioned nor read. The Windows read-then-write add_if_absent is removed: no approval key is kept or trusted on Windows. - tool_approval: preview and approve call the store through spawn_blocking. approve reads back the stored key and the stored node and runs the gate; ApprovalError::NotInEffect (ABORTED) when it does not pass. The simulated post-write check is gone. The preview carries a one-line target (proto DescribeToolApprovalResponse.target). - nodespace tool approve: one-line fields show a line break as an escape; the binding, its target and the credential references show non-ASCII as escapes with a note; schema first, binding last, target right above the question. - SecretService: Set runs through set_in_place, so a refused Set wipes the value in the request on the service's own path. - Module docs and the skill reference state the same-user limits of the approval. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on at the screen (#4291) - nodespaced asks the system (LocalAuthentication, deviceOwnerAuthentication) before ApproveTool writes a tag and before SecretService Set/Delete change anything: new user_presence module with the macOS adapter (a new LAContext per change, Touch ID reuse 0, 60 s limit then invalidate, on a blocking thread inside an autorelease pool), an unavailable check for other platforms, and a fake for tests. -1004/-4/-5 map to "confirm at this Mac's screen"; canEvaluatePolicy is never consulted. - One dialog at a time across approvals and credential changes, and a 30 s cooldown after one that was not confirmed. The reason is written by the daemon: tool name, code and target as ASCII with \u{..} escapes, cut. - ApproveTool: peer gate, then review (digest must still match, no dialog otherwise), then the dialog, then the write with the version read before it (an edit during the dialog is a conflict), then the read-back gate. tool_approval splits into review() and write(). - DescribeToolApproval returns `code` (first 8 hex digits of the digest as XXXX-XXXX); the CLI shows it and asks to confirm only a dialog with it. - A bare program name (tool-cli program, stdio tool-mcp command) is resolved on the daemon's PATH when shown; the preview and digest cover the full path and the approval writes it into the tool. A name not on the PATH cannot be approved. - SecretService refuses a bad name or value before asking, and wipes the value of a Set that was not confirmed. The CLI says to confirm. - Limits text updated in tool_approval, remote_confirmation and spawned; skill reference regenerated. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… seconds A test that goes wrong while a dialog is waiting now fails instead of hanging on it. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ty check at start (#4291) - nodespaced makes the approval key at start from the OS random source (ApprovalKey::generate, getrandom), one per process for every database, and keeps it only in memory: nothing stores or reads nodespace.secrets/approval-key any more, so a key planted there has no effect. Deleted: the approval-key account, approval_key, provision_approval_key, add_if_absent, has_add_only_write, the macOS add-only keychain write and the direct security-framework dependency. - RemoteToolHost takes the key from the daemon instead of reading the store on every turn; tool_approval::preview/write take the key, and write reads the node back and checks it under the same key (commit, then in_effect). - New code_identity module: csops(getpid(), CS_OPS_STATUS). A release build makes a key only with a valid non-ad-hoc signature, the hardened runtime, no get-task-allow and no debugger attached; otherwise no key and ApproveTool says it is not a signed release. A debug build makes one with a warning that it is not a security boundary. Other platforms make none (ApproveTool: FAILED_PRECONDITION, nothing offered). - SharedLocalAgent holds the key (installed once at startup, none until then); ApproveTool checks for it after the digest and before the dialog. - The turn's host is built in remote_tool_host, so a test can see what a turn is offered. - Approvals now end when the daemon restarts; the CLI and the skill reference say so. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…e it (#4291) - Core counts, on the write path itself and before the write is stored, every write that leaves a tool off (behaviors::tool_off_writes, in memory per process; tool_is_off). Not through the event bus. - remote_tools::approve records each issued tag with the node's creation time and that count, read before the tag is written. The new assess_stored admits a tool only while both still hold (Refusal::NotLive); the host and tool_approval's preview and read-back use it. - So a tag read before the tool was turned off and written back afterwards with enabled: true is not offered, and neither is a tool deleted and made again under the same id with its old tag. Approving it again works. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…approval, program content pinned (#4291) - Code (M1): HMAC-SHA256 under the in-memory approval key over the preview digest, 48 bits as XXXX-XXXX-XXXX (behaviors::tool_approval_code); empty without a key, and the CLI then refuses before asking. The dialog reason starts with the code, then the name, then what the tool runs; in node text `(`, `)`, `:` and a dash between code-shaped hex groups are escaped. - Approvals (M2, L1, L8, L9): new core tool_approvals ledger, keyed by database file and node, recording tag, version after the approval's own write, creation time and the program file's SHA-256. The gate (assess_stored, now given the NodeService) admits a tool only while its stored version and creation time match, so any later write (an edit, reverted or not, turning off, archiving, a type change) ends it. A delete the node service reports removes the record (store notifier and emitted events), so a row restored by writing the file directly is not approved. The record is written before the approval's update and taken back when the update fails. At most 4096 records per database, oldest first. The in-memory off-write counter is removed. - Program content (M3): the preview resolves the program (bare name on the PATH, then the file hashed) on a blocking thread; the digest covers the SHA-256, DescribeToolApproval returns `program`, the CLI shows it and what the pin means. The cli and stdio-mcp runners check the file's SHA-256 right before they start the program (process::check_program_file); a program-starting tool with no pin recorded is not offered. - Presence (L2, L4): the cooldown doubles with each unconfirmed dialog in 10 minutes (up to 15), 5 s of quiet after a confirmed one, refusals logged and saying another program may be asking; -1004/-4 wording no longer claims SSH is refused (the panel shows on the Mac's screen). - Credentials (L3, L5): SecretServiceImpl::new/with_gate take the presence; keychain() with no check installed refuses every change and says why; keychain_with_presence is what daemons build. install_approval_services moves into the library. A Set's value is wiped on drop, including when the client hangs up while the dialog is open. - Code identity: also rejects linker-signed (ad hoc) binaries. - ACP launch secrets get a loud doc comment: no approval gates them yet. - Tests: vacuous ones replaced (planted key now wired into the runners with a read counter, main wiring asserted, csops flags checked); new tests for each finding. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- The ledger unit test checks a moved version before a new creation time, so each rule is tested on its own record. - The delete test also prunes a tool through a trusted import, the path whose delete is reported as an emitted event. - The made-again test deletes behind the node service's back and writes the new node up to the approved version, so only the creation time tells them apart. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…shows credentials and program first, bounded hashing (#4291) - F1: every write the node service reports that is not the approval's own ends its record on the spot (store notifier Updated at another version, Created, Deleted; emitted NodeUpdated/NodeCreated/NodeDeleted), so a row written back directly after the user ended an approval is not offered. - F4: the record is still written before the approval's write, and a look at the node before that write lands no longer drops it: only a later version or another creation time does. - F2: the dialog reads code, name, credentials, then the full program path or the method and scheme://host:port, kept whole; only the arguments or the rest of the address are cut. `://` after a scheme and a port's `:` stay readable; other colons, `(`, `)`, `;` and code-shaped dashes are escaped. - F3: program files are opened non-blocking, must be regular files of at most 256 MiB (checked on the open file) and are hashed as a stream. - F6: the preview, CLI (WARNING line, new `program_warning` field) and dialog say when the program file or its folder is writable by the user, or a `#!/usr/bin/env X` script starts X from the PATH. - Nits: an unpinned program is refused at the runner too; a relative program path is refused at the preview; one keyless guard (in assess) instead of two; the planted-key read counter is documented as a tripwire; a Set's value is in Zeroizing for the store task, so a panic still wipes it. - Docs: limits rewritten (shadowed CLI, polling pressure, check-to-start race for user-writable files, direct writes). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The delete-path test now also updates the tool through the store itself, the path its notifier reports, besides an update through the node service. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The approval record no longer decides anything from a version number. NodeService::write_tool_approval opens it as pending and makes the approval's write inside a task-local mark; the first update reported for the node inside that mark makes it live, and any other reported write (an update at any version, a create, a delete) ends it. The store notifier ends a record unconditionally. A guard takes the record back unless the write returned success, including when the caller drops the write while it waits for the database. A merge ends the record of the survivor and the loser before it runs, and any write of a schema node (through the service or the store) ends every record of its database, which covers field renames and a type retargeting what it extends. The dialog now gives the code, the name and the program or host first, then at most four credential references (each cut at 64 characters, the rest counted), then the arguments. The host is read with a URL parser, so escaped dots, user names and backslashes show the host a call reaches. A replaceable program file and a script that starts a program from the PATH are warned apart. A program file is opened once (O_NONBLOCK | O_NOCTTY) for its hash and its #! line. It counts as replaceable when the file, a folder above it (as written or as it resolves) or its #! interpreter is owned by or writable by the user. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mstomar125
force-pushed
the
issue-4291-approve
branch
from
November 21, 2026 12:42
f2e5598 to
653cf25
Compare
This was referenced Nov 21, 2026
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: the enable-and-approve step for remote tools (
tool-cli,tool-rest,tool-mcp). The user signed off the agent-lane work inpackages/agentfor this issue.The gate
A remote tool is offered to the model only after the person at this Mac approves it, and the daemon asks the operating system to confirm that a person is there. A same-user program (the model, a tool program, an agent, any other process of the user) cannot approve a tool or change a credential through the daemon on its own.
nodespace tool approve <node-id>(CLI) shows the tool's name, kind, description, parameter schema, credential references (references only), every binding field, for a tool that starts a program the program file and its SHA-256, and on the line above the question what the tool runs or where it sends a call. It shows a code (XXXX-XXXX-XXXX) and asks the user to confirm only a dialog that starts with it. Control, invisible and bidi characters are escapes everywhere; in the binding, its target and the program file every character outside ASCII is an escape and flagged. It refuses without a terminal on both sides, before it contacts the daemon, and when the daemon gives no code (it cannot approve tools), before it asks. The MCP passthrough refusestool. Typing the tool's name is a check on what the user meant, nothing more.DescribeToolApprovalreturns that preview, the digest (SHA-256 over a label and the length-prefixed node id, name, description, binding hash and program-file SHA-256), thecodeand theprogram. It writes nothing. The code isHMAC-SHA256(approval key, "tool-approval-code-v1" || digest), its first 48 bits: only the daemon can make one, so nothing can search offline for a second tool that shares a code, and searching through the RPC would take on the order of 2^48 node writes.ApproveTool, in this order:SpawnedProcessGate, kept as defence in depth): a program the daemon started for a tool, or one descending from one, is refused before the request is read;FAILED_PRECONDITIONwith the reason, and no dialog;ABORTEDand no dialog is shown;nodespacedcalls LocalAuthenticationevaluatePolicy(.deviceOwnerAuthentication)(Touch ID, a paired Watch or the login password in the system panel). The panel reads "nodespaced is trying to approve code XXXX-XXXX-XXXX for the remote tool “NAME”, which runs /full/path/to/program (that file's content is pinned), with the credentials TOKEN from keychain:tok, then " (for a web tool: "which sends POST https://host:port, with no credentials, then /path?query"). The daemon writes all of it, in this order: the code, the name, then the full program path or the method andscheme://host:port, kept whole, with what is said about the pin; then the credential references (at most 4 named, each cut at 64 characters, the others counted as "+N more"); then the arguments, or the rest of the address, cut at 120 characters. So the real code and the program or host come first, before anything long, and a panel that shortens a long reason cuts only what comes after them. The host is the one a call reaches, as a URL parser reads the text (Url::host_str()and the port):https://api.github.com%2eevil.com/xshowshttps://api.github.com.evil.com,https://[email protected]/showshttps://evil.com, a name outside ASCII shows in punycode, and a text the parser cannot read is shown as written with "(the host is not a plain address)". Node text is shown as ASCII with\u{..}escapes, and(,),;, any:that is not part of an address (https://, a port) and any dash between two four-hex-digit groups are escaped, so the text a node holds cannot be laid out as a second code or a "(code …):" of its own after the real one. A program file programs of this user can replace adds "WARNING: programs of this user can replace that file"; a#!/usr/bin/env Xscript adds, apart, "WARNING: it starts X from the PATH, which is not pinned". A program cannot answer the dialog;NodeService::write_tool_approval, below): an edit made while the dialog was open is a conflict (ABORTED), nothing is approved, and the approval's record is taken back;ABORTED("written but not in effect").SecretService.SetandDeletego through the same peer gate and then the same dialog ("nodespaced is trying to change the credential “NAME”"). A bad name or value is refused before anyone is asked. A request that is not confirmed changes nothing. ASet's value is wiped where it lies on every path that does not store it, including a client that hangs up while the dialog is open.ListNamesis neither gated nor asked. The CLI says on standard error that a dialog is coming.How the dialog is asked (
packages/daemon/src/user_presence.rs):LAContextper change, Touch ID reuse 0, on a blocking thread (never the main thread, which the tray owns, never an async worker), inside an autorelease pool. No answer in 60 s: the context is invalidated and it is a no.canEvaluatePolicyis never consulted.-1004(the daemon itself runs outside a logged-in screen session),-4(the screen locked, or the session switched to another user) and-5(no login password) are "confirm at this Mac's own screen" (FAILED_PRECONDITION); every other failure is "not confirmed" (PERMISSION_DENIED).UNAVAILABLE). After a dialog that was not confirmed none is shown for 30 s, doubling with each further one within 10 minutes, up to 15 minutes. After a confirmed one none is shown for 5 s, so a program cannot slip a request in right behind the person's own. Both refusals are logged and say that another program on the Mac may be asking.Programs. A
tool-cliprogramor a stdiotool-mcpcommandgiven as a bare name would be looked up on the daemon'sPATHat every call. The preview resolves it on the daemon'sPATH(on a blocking thread), shows the full path, the digest covers it, and the approval writes that full path into the tool. Either way the approval pins the program file's content: its SHA-256 is part of the digest the person approves, it is recorded with the approval, and thetool-cliand stdiotool-mcprunners hash the file again right before they start the program (process::check_program_file). A file that changed (an update,brew upgrade, a copy planted at the same path) is not started, and the call says to approve the tool again. A program with no pin is refused twice over: the gate does not offer the tool, and the runner does not start it. A name not on thePATH, a relative path, or a file that cannot be read cannot be approved. Hashing opens the file once (O_NONBLOCK | O_NOCTTY), requires a regular file of at most 256 MiB (checked on that open file, so a FIFO, a device such as/dev/zeroor a directory is refused), reads it as a stream, and takes the#!line from the same bytes. Where the pin does not hold, the preview says so (aWARNING:line in the CLI, theprogram_warningfield, and a warning in the dialog), each case apart: when the program file, any folder above it (as written, where a symbolic link lies, and as it resolves) or the interpreter its#!line names is owned by the user or writable by the user; and when a#!/usr/bin/env Xscript startsXfrom thePATH. It is a warning, not a refusal.The approval key
nodespace.secrets/approval-keyis gone, and so is everything that wrote or read it (approval_key,provision_approval_key,add_if_absent,has_add_only_write, the macOS add-only write, the directsecurity-frameworkdependency). A key planted in the keychain under that name has no effect, and nothing reads that item while a turn is offered tools or runs one. The per-turn keychain read is gone too: the host takes the key from the daemon.packages/daemon/src/code_identity.rs):csops(getpid(), CS_OPS_STATUS). A release build makes a key only when its signature is valid and not ad hoc (neithercodesign -s -nor a linker signature), the hardened runtime is on,get-task-allowis off and no debugger has attached. One that fails gets no key: nothing is approved or offered, andApproveToolsays "this nodespaced is not a signed release". A development build (debug assertions) makes a key with a loud warning that it is not a security boundary.nodespace secret setstill works there, since the dialog does not depend on the signature.ApproveToolrefused withFAILED_PRECONDITION("not available on this platform"), nothing offered.nodespace_daemon::install_approval_services(&shared)(in the library) installs the dialog check and the key before any database is opened, and returns the check forSecretServiceImpl::keychain_with_presence. A daemon that does not call it approves nothing and changes no credential:ApproveToolsays no key is held and why, andSecretServiceImpl::keychain()refuses everySetandDelete, sayinginstall_approval_serviceswas not called.SecretServiceImpl::newandwith_gatetake the check too: there is no way to build the credential service that asks no one.Every change to an approved tool ends its approval
An approval is a tag plus a record (
nodespace_core::tool_approvals, in memory, per database file and node). The record is a one-shot token, and no decision about it rests on a version number:NodeService::write_tool_approval(the only thing that opens a record) opens it as pending, then makes the approval's write inside a task-local mark that says "this task is writing the approval of this node in this database".remote_tools::assess_stored, used by the turn's host and by the approval's preview and read-back); a node that differs in either ends it.So any later write that changes what the approval covers ends the approval, through every path the daemon reports (a few writers are not reported: title-only and bookkeeping writes, and the store-level updates whose notification can be skipped by a failed read-back or cancellation; none of them touches what the tag covers, apart from the narrow cases listed in the follow-ups below): turning it off (which also removes the tag), an edit (and reverting it does not bring the approval back), archiving and bringing back, a change of type away and back, a merge, or writing the old tag back with
enabled: true. The model's built-inupdate_nodecan write a tool's binding (it refuses only conversation records); with this, such a write only ever turns the tool off. A row put back afterwards by writing the database file directly, with its old version, fields and tag, is not approved: the reported write that changed the row ended the record, and lowering the stored version behind the service's back cannot make a later write look like the approval's own. A node made again under the same id has a new creation time as well. The record is per database, so a copy of an approved node in another database is not approved there. At most 4096 records per database are kept; the oldest goes first, which only ends that approval.What this defends against, and its limits
It is a defence against the model, the tool programs the daemon starts, and any other same-user program acting through the daemon: an approval or a credential change needs a person at the screen to confirm the system's own dialog, the key that tags approvals and makes codes exists only in the daemon's memory, and every change to an approved tool ends its approval. It is not a defence against everything a same-user program can do:
nodespace tool approveprinted is not fooled by a dialog for another tool. That holds only while thenodespacethey ran is the real one. A program of the user can shadow the command (a shell function or alias, an earlierPATHentry, a user-writable Homebrew or/usr/local/bincopy): the fake can callDescribeToolApprovalfor a tool of its own, print that tool's code next to the user's tool text, and sendApproveToolfor its own tool. The dialog's code then matches, and its name can equal the user's unapproved tool's; only the program or host and the credentials in the dialog tell them apart. A person who does not compare those, or who confirms a dialog they did not start, can be fooled. A credential dialog names the credential but carries no code. A display the user can trust is the signed app's (Stage 5)..pkginstalls its LaunchAgent in the root-owned/Library/LaunchAgents, but the app's own per-user LaunchAgent plist is user-writable,launchctl bootoutstops the daemon either way, an Intel Homebrew install keeps it in a user-writable/usr/local/bin, and the user can run a daemon of their own build. Such a daemon approves whatever it likes. The code-identity check only stops an unsigned, ad hoc or debuggable release build from making a key.~/bin,node_modules) a loop that renames a copy into place wins that race on a real share of calls (around one in four when both copies are equally likely to be in place), so the pin is a real control only for a file the user cannot write; the preview and the dialog warn when the file, a folder above it or its#!interpreter is owned by or writable by the user, and do not refuse. The check cannot see every way a file can be replaced (an admin user can write a root-owned folder throughsudo). A#!/usr/bin/env Xscript startsXfrom the daemon'sPATHat each call, which is not pinned (warned apart), and no pin covers what a program loads (an interpreter's script, a package annpxcommand fetches).securitytool can still overwrite a credential's value directly. The dialog covers changes made through the daemon only.AnswerConfirmation(the per-call question) has the peer-gate gap. It is still gated bySpawnedProcessGatealone: a same-user program the gate does not recognise (an orphaned descendant of an in-app shell or ACP agent, an agent the user started outside the app, a program that left its process group) can read a pending question's id and digest from its card and answer it. Stage 5 below.Set's value is wiped in the daemon's own copies, but not in the gRPC receive buffers (tonic/h2) it arrived in.enabledandapproved_bindingare declared local-only, and a tag is a MAC under this daemon's in-memory key. So a peer's write cannot make a record match: any write of it the node service reports ends the record, a node it creates is new, and it cannot supply a tag that verifies.AcpLaunch.secretsresolves keychain values into the environment of whatever program the launch names, with no approval and no pin. Nothing sets a launch from data a model or another program can write today; before anything does, the launch needs this same gate (a doc comment on the field says so).Also, a command run from the in-app PTY terminal or by an ACP agent descends from a recorded program, so
nodespace tool approveandnodespace secret set|deleteare refused there. The user runs them from a normal terminal.Gated and ungated RPCs
LocalAgentService.ApproveToolSecretService.Set/DeleteLocalAgentService.AnswerConfirmationLocalAgentService.DescribeToolApprovalGetNodealready shows, plus the codeSecretService.ListNamesOn Windows a named pipe carries no peer pid and there is no dialog, so
ApproveTool,AnswerConfirmationandSecretService.Set/Deleteare all refused there. That is a change fornodespace secret set|deleteon Windows (and Linux, which has no store anyway): they no longer work there. A stored credential could only be used by an approved tool, and nothing is approved on those platforms;env:references still work.Tests
Reproduce-first; every new test was mutation-checked on its own: each fails under a mutation of the code it guards and passes on the clean tree. 137 mutations in all, none left surviving: 28 for the dialog, 14 for the in-memory key, 7 for the first live record, 37 for the second review round, 20 for the third and 31 for the fourth. In the fourth round the version-based rule the reviewer broke (keep a record when a reported write leaves the approved version) was put back as a mutation: the new direct-write test and the one-shot unit test both fail under it. Two forgets added to the field-rename paths survived their mutations, because the schema node written in the same transaction already ends every record; they were removed, and the mutation of the schema-write rule then failed the test at the rename itself. In the second round three first survived, each because a second rule also stopped the test (a pruned record, a delete hook, a version check); those tests were changed to isolate one rule and the mutations then failed them. In the third round the mutation of the store notifier's update branch first survived: the tests' updates went through the node service, which reports them as emitted events (that branch's mutation was killed). A store-level update was added to the delete-path test, and the notifier mutation then failed it. A mutation that would show a real dialog was never used.
nodespace-core:tool_approvals: an approval is live only for its tag, version, creation time and database, and a node that differs (a lower version as much as a higher one) ends it; a pending record never counts and a look at the node leaves it; the token is consumed once, only by a write inside the approval's own mark, and a write outside it, one for another node inside it, a second one inside it, or any later write at any version ends it; an approval whose write did not land takes its record back, pending or consumed, and no newer one; a schema change ends every record of its database and no other; at most 4096 records per database, oldest first.nodespace-agenttool_approval:PATHcannot be approved; one that resolves elsewhere since the preview, or whose file changed since the preview, is refused as changed; a full path is not looked up but is pinned by content; a stdio MCP command is pinned and an HTTP server has nothing to pin.PATHlookup findssh, hashes the file and refuses a missing name or file; a relative program path cannot be approved.PATH) the preview says so, and the approval still works; the dialog's parts name the program or the host apart from what may be cut; the dialog names the host a call reaches (an escaped dot, a user name before@, a backslash, a name outside ASCII, an upper-case scheme and a default port), and text a parser cannot read is shown as written and said so.nodespace-agentremote_tools, through the host and a real node service:tool-clirunner); in the MCP runner a stdio server whose file changed is not started and one that matches is.nodespace-agentprocess: only a regular file of at most 256 MiB is hashed (/dev/zero, a FIFO, a directory and an oversized file are refused, none hangs); a program with no pinned content is not started; a file of this user is replaceable even when it is not writable, a system program is not, and an#!/usr/bin/envscript names what it starts; the walk covers the folders above the path as written (a link in a folder of the user) and above what it resolves to; a script whose#!interpreter is replaceable is replaceable.nodespace-daemonuser_presence:;and code-shaped dashes escaped, while an address keeps its://and port; a replaceable program file and a script that starts a program from thePATHare flagged apart.-1004/-4/-5are "unavailable", an unanswered dialog is invalidated. The real-dialog smoke test is#[ignore]and, even in a run of the ignored tests, does nothing unlessNODESPACE_SHOW_REAL_DIALOG=1; it was not run.nodespace-daemonApproveTool, with a fake dialog: the dialog's two program warnings follow the review's findings apart (a PATH lookup is not called a replaceable file); a wrong digest is refused with no dialog; a cancelled or unavailable dialog writes nothing; the dialog is the one built from the code, name and target; an edit while the dialog is open is a conflict; a second approval while one is open is refused; no key refuses with the reason and no dialog; a turn offers a tool approved here and not one tagged under another key even with a record in place; the check and the key the library installs reach every database's service, and without them nothing is asked or approved. Over a real socket the daemon's own gate refuses before any dialog, and an admitted peer approves what it was shown, with the same keyed code.nodespace-daemonSecretService: a store that panics while writing fails theSet(and the request holds no value); not confirmed (cancelled or no screen) leaves the store unchanged and zeroes theSetvalue; aSetdropped while the dialog is open has its value zeroed where it lies; a confirmed change goes through and the dialog names the credential; a bad name or value is refused before anyone is asked; a refused peer is refused before any dialog; a service built without an installed check refuses every change and says why.nodespace-daemoncode_identity: a signed release needs a valid identity signature (notcodesign -s -, not a linker signature), the hardened runtime, noget-task-allowand no debugger; a key only on macOS for a signed release or a development build;csopsreturns this test binary's real flags (valid, linker-signed).nodespace-daemonmain: every serve loop installs the check and the key before it opens a database, and builds the credential service with that check.nodespace-cli: the question names the code; the pinned program file is shown with what the pin means, and the WARNING where it does not hold; a daemon that gives no code is not asked to approve.approval_key-store tests whose code is gone; "an approval stores nothing in the credential store" (nothing touches that store); "the reason is handed to the system as given" (it tested the fake); the field check that stood in for the main wiring.Not covered by an automated test: the real LocalAuthentication dialog and the objc block that carries its answer (compiled and clippy-clean, never run: it would show a dialog on this shared Mac), how the real panel lays out or shortens a long reason,
csopson a signed release build, and the window between the program file's check and its start. That a panic in the store task wipes the value rests onZeroizing(the buffer is freed with it, so it cannot be read back).O_NOCTTYhas no test of its own. The own-write mark is task-local: it relies on the node service reporting the approval's write on the task that made it (true today, and every approval test depends on it); if that ever moves to another task, the approval fails closed ("written but not in effect"), it does not open.Checks:
cargo fmt;cargo clippy -p nodespace-core -p nodespace-agent -p nodespace-daemon -p nodespace-cli --all-targets -- -D warnings -D clippy::unused-asyncclean;bun run quality:fixclean (no changes);bun run skill:checkup to date.bun run test:changedwas run directly with a scratchNODESPACE_HOME: the scripts tier passed; the skill tier failed only on the knownplugin-session.test.ts› "takes a write from a script as the session's own through the journal", which fails wheneverNODESPACE_HOMEis set. Without that variable the skill suite passes, 312 of 312. The Rust tier was then run on its own under the machine slot with a scratchNODESPACE_HOME:types:checkup to date;shape:checkin step (no schema or seed changed).node-types:checkskipped (no docs checkout beside the worktree; no node type changed). The docs repository'stool-registry.mdandnode-types.mdstill describe the stored key and need the new text (handed over separately; this PR does not touch the docs repository).find_skills_schema_metadata_test.Verify by hand (signed
.pkg, at the Mac's screen)nodespace tool approve <id>prints a code; the dialog starts with the same code, then the tool's name and the full program path or the host (with "that file's content is pinned" for a program), then its credentials, and the arguments last. Touch ID or the password approves; Cancel leaves it unapproved and not offered. Check how the panel shows a long reason (whether it cuts it), and that the code, name and program or host stay visible.osascriptmust not complete the dialog.codesign -dv --entitlements - /usr/local/bin/nodespacedshows the runtime flag and noget-task-allow;lldb -p $(pgrep nodespaced)is refused.security add-generic-password -A -s nodespace.secrets -a approval-key -w <64 hex>and write a tag made with it throughNodeService: the tool must not be offered.nodespace secret set <name>anddeleteshow the credential dialog; Cancel leaves the stored value as it was.tool-clitool, then replace its program file (orbrew upgradethe formula it names): the next call is refused with "changed since the tool was approved"; approving again works./opt/homebrew/binor~/bin: the CLI and the dialog show the WARNING that programs of this user can replace the file. A#!/usr/bin/env python3script under a root-owned folder shows only the PATH warning.tool-resttool withurl_templatehttps://api.github.com%2eevil.com/x: the CLI's binding shows the text as written; the dialog nameshttps://api.github.com.evil.com.Follow-ups (not here)
keychain-access-groupsentitlement, so approvals survive a restart and only the signed daemon can read the key. Needs the Apple account holder, a provisioning profile, an app-like bundle for the daemon, andbuild-pkg.sh/release.yml/ LaunchAgent changes. Credentials could move there too (closes limit 5).peer_auth.rs(LOCAL_PEERTOKEN) and restrictAnswerConfirmationto the signed app (SecCodeCheckValidityagainst the team id). It is also what makes the review the user reads come from a program they can trust (limit 1). Closes limit 7. The same check is part of what an ACP launch's binding needs (limit 13).Not merged; merging is the user's call.
🤖 Generated with Claude Code
Known follow-ups from the last review (low, fail closed or need the user's own approval to race with): a record goes live at buffer time, so a concurrent
DescribeToolApprovalpoll can end a re-approval of a still-enabled tool (denial of service only); a merge forgets before it takes the write lock and a schema merge ends only the two merged ids; store-level updates notify after a read-back that can fail;begin,as_own_writeandreported_updateshould bepub(crate); the replaceable-program warning does not walk every symlink hop, checks one interpreter level and reads 256 bytes of the#!line; credentials beyond the fourth are hidden in the dialog in an order the node chooses, so the code and the program or host are what the user can rely on; a very long program path can push the warnings out of a shortened panel; any schema write silently ends every approval in its database.