Repository navigation
Add the device credential store and nodespace secret commands (remote tools, step 2) - #4309
Merged
Merged
Conversation
A tool node holds only a keychain:<name> or env:<NAME> reference. This adds the store behind keychain: references (macOS keychain, Windows Credential Manager), a SecretService in the daemon, and nodespace secret set / delete / list-names. Values are never listed, never an argument, never in an error. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- Windows credential manager holds at most 2560 bytes per item as stored (UTF-16): a longer value, and a names index that would pass it, are refused with a clear error and rolled back; keyring's TooLong maps to the same message. - A failed index write puts back the value the account held (an unlisted old value is no longer destroyed). - SecretValue and the daemon's Set request overwrite the value when dropped. - Tests: keychain reference never falls back to env; limits against a Windows-like backend; orphan restore. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mstomar125
force-pushed
the
issue-4291-secret-store
branch
from
November 19, 2026 11:45
72ba1fb to
fd5958e
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.
Refs #4291, step 2 of the approved spec (task C9): the device store for the credentials that remote tools refer to. Core side only: no change under
packages/agent. Nothing reads a credential yet; the executor PRs are the first consumer.What it adds
nodespace_core::secrets: aSecretStoreover aSecretBackend. The real backend is the OS credential store (macOS keychain, Windows Credential Manager) throughkeyring; an in-memory backend is provided for tests.resolve_credentialresolves akeychain:<name>orenv:<NAME>reference at call time.SecretValuehas noDisplay/Clone/Serializeand a redactedDebug.SecretService(gRPC,Set/Delete/ListNames) in the daemon, process-global (not routed by database).nodespace secret set <name>/delete <name>/list-names. The value is read from a hidden terminal prompt, or from stdin when stdin is not a terminal; it is never an argument (clap rejects one).list-namesprints names only; no command prints a value.nodespace-types(is_secret_name,secret_value_problem,MAX_SECRET_VALUE_BYTES), shared by core, the daemon and the CLI.bun run skill:gen); thesecretsubcommand is refused by the MCP passthrough (new test).Design
Setrequest;SetSecretRequesthas a hand-writtenDebugthat prints<redacted>.index, a JSON array of names, sorted). Values live undervalue:<name>, so no name collides with the index. A failed index write rolls the value back; an unreadable index is an error, never an empty list. If a user deletes a value in the OS tool, its name still lists untilsecret deleteis run..,_,-(thekeychain:grammar). Value: 1 to 16384 bytes, UTF-8, no NUL; one trailing line break is stripped from stdin input. Windows is stricter: the credential manager stores at most 2560 bytes per item (UTF-16), so a value is at most 1280 UTF-16 units there, and the names index (one item) holds roughly 19 names of full length or about 70 of 16 characters. A value or a new name over the platform limit is refused with "value too long for this platform" / "too many secrets for this platform", nothing is left behind, and keyring'sTooLongmaps to the same message. The index is not sharded.SecretValueoverwrites its value on drop, and the daemon overwrites theSetrequest's value after storing it.Set/Delete/ListNamesover the daemon socket: the same boundary as every other daemon RPC. Values are never readable through any RPC. The rig/dev TCP gRPC mode exposes the service to any local process: do not use real credentials there.env:: an empty variable counts as not set; no deny-list (the approval fingerprint and the per-call confirmation are the guard, as in the spec).Needs attention
BaseServices: it gains asecrets: SecretServiceImplfield (useSecretServiceImpl::keychain()). For the sync core-pin bump line. Also note sync's current core pin predates the remote tool types, so per-devicelocal_onlyenforcement forenabled/approved_bindingonly takes effect after that bump.env:references are the only option. Real Linux support needslibdbus-1-devin core's CI (and the arm64 cross build), so it is left out on purpose.Tests
secrets::19, daemonsecret_service5, protosecret_debug1, CLI unit 4 + newsecret_cliintegration 5 (the compiled binary against an in-process service), plus the MCP passthrough decision test.cargo checkandclippy -D warningsover the workspace clean;bun run test:changedpasses.keychain:falling back to env; value ceiling unchecked; ceiling counting bytes not UTF-16; index ceiling unchecked; rollback deleting the old value; old value not read; wipe a no-op) (one slot acquisition): name check removed; value check removed; empty / NUL / one-over-the-limit accepted; delete leaving the name; rollback removed; index holding values; index unsorted;SecretValueDebug leaking;env:reading the store;keychain:reading env; empty env counted as set; proto Debug leaking; CLI accepting a value argument; CLI stripping every trailing line break; daemondeletealways reportingexisted.Not run here:
node-types:check(no change to any node type or schema; skipped by the tool, no docs checkout beside the primary).🤖 Generated with Claude Code