Repository navigation
feat: resolve op:// secret references for downstream servers (see Consiliency/pmcp#487) - #499
Draft
ViperJuice wants to merge 11 commits into
Draft
ViperJuice wants to merge 11 commits into
ViperJuice wants to merge 11 commits into
Conversation
…unner, redaction registry Phase P2 of #487 (plan sections 3.1, 3.3, 3.4, 3.7). New pmcp.secret_refs: reference classification and the v1 grammar, the service-account token read on demand from CREDENTIALS_DIRECTORY, the credstore and ~/.config/pmcp (never the environment) with descriptor, owner, mode, size and prefix checks, the trusted op executable with ancestor checks, op's own environment builder, and a bounded, single-flighted resolver (at most two op processes) with typed failures. New pmcp.secret_registry: unconditional exact-value redaction of the token and every resolved value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…path Phase P2 of #487 (plan sections 3.2, 3.5, 3.7, 3.10). Credential lookups record provenance (credential_sources); configs keep reference strings and only user-store credentials and opted-in operator own env (resolve_secret_refs) resolve. Resolution runs before teardown and outside the lifecycle lock with a config-generation re-check, in connect, restart, lazy start, reconnect, refresh, install and the update probe; typed failures are contained and never retried. The npm identity gate sees key names only. References in remote headers, the environment, ~/.env and repository files are refused; OP_* control names are never loaded or inherited. Redaction runs before truncation in tool output, resources, prompts, diagnostics, exception text, catalog text, child stderr, installer output and logs. /health and gateway.health report the secret_refs capability; pmcp secrets set writes a reference only once the serving gateway reports it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#487 plan sections 6 and 7: a fake op executable records argv, env, cwd and stdin; nothing calls the real op or 1Password. The inventory, parity and echo guards learn the new builder, lookup and health call site. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ve check #487 P2: README, MIGRATING, SECURITY and CHANGELOG, and scripts/op_live_compat.py, the value-free live compatibility check that is the P2 merge gate (operator-run; not run in CI). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reaches the environment #487 P2 mutation follow-up: O_NONBLOCK on the token open is now observable (the walk alone refused a FIFO by lstat). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blocking: exact-value redaction of task metadata on every task surface and a final recursive redaction of every gateway tool response before audit and serialization (A1/F2); a skipped ~/.env reference is held at its layer by environment_holds, the lookup and auth_connect (F1); the config generation is bumped only by publishing a replacement, never by a resolution, and a superseded config is never spawned -- the current published config is re-resolved once, then config_changed, and a reconnect never respawns a replaced config (G1/N1); pmcp doctor reports the token paths searched, the one used and differing systemd/credstore copies, value-free (A3). Also: ClientManager.refresh keeps a running server whose lookup fails (A2); agent-registered servers never receive a resolved reference (N3); an explicit child env base keeps a server's own OP_* (N4); host-class static reasons are re-checked on demand (N5); doctor reports store and refused references correctly (F3); a reference-shaped PMCP_AUTH_TOKEN is removed for every transport (G2); op's exit wait uses the remaining budget (G3); tokens below the redaction floor are refused (G4); overlapping registered values leave no residue; bounded_wait instead of asyncio.wait_for; the op spawn site joins the spawn-env inventory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…en report #499 round 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blocking: a restart always hands its resolution (generation and fingerprint, empty overlay included) to the connect, so a replacement published during the teardown is resolved and started, never overwritten (A4); the restart validates its resolution under the lifecycle lock BEFORE tearing anything down, resolves the current replacement once outside the lock, and leaves the running instance up on a second change or a lookup failure -- the manager-level refresh does the same (A5); registered values are redacted from non-string scalars and mapping keys by their JSON rendering, keeping JSON valid, in task metadata and the final response pass (A7). Also: a fixed token clears the cached host-only reason so the spawn proceeds, and a manifest entry keeps a host reason on the entry instead of being skipped (N5, R2-N1); the dispatcher's exception path is exact-redacted before its cut (R2-2); pmcp doctor says when the systemd copy is not visible (R2-N2); tasks_cancel sanitizes before it audits; redaction has a fail-closed depth bound and a no-match fast path; reconnect records its typed reason on the status; environment_holds docstring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…unit #499 round 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…und 3) #499 r3 R3-N1: one shared helper, ClientManager.prepare_validated, now carries the pre-teardown discipline for gateway.refresh, ClientManager.refresh and restart_server: publish, resolve outside the lifecycle lock, check each resolution under the lock against the config published now BEFORE any teardown, re-resolve a replaced config once against the current one, and hold (keep running, do not start) a name whose replacement fails its lookup or changes again. Tests drive the real GatewayTools.refresh handler; the lifecycle recheck of a stored host reason gets a behavioural test (R3-N2), and prepare_spawn documents that it clears that reason on the shared config (R3-N3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erms (see #487) The claim checker's R18 rule rejected 'consent and provisioning policy' outside the claim region; reword without changing the claim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Phase P2 of #487: resolve 1Password
op://secret references for downstream servers, per the approved planplans/detailed-pmcp-487-op-secret-references-20261108.md(sections 3.1–3.5, 3.7, thesecret_refscapability and the gatedpmcp secrets set). Builds on P1 (#489). Out of scope: P3 (credential_rejected,auth_check), P4 (migrate-op,doctor --resolve, writer lock), release, dotfiles.What changes
pmcp.secret_refs(new): v1 reference grammar (3.3); the service-account token read on demand from$CREDENTIALS_DIRECTORY→~/.config/credstore→~/.config/pmcp. It is never read from the environment, and the read checks the confined walk,O_NOFOLLOW|O_NONBLOCK,fstatowner/mode, the 4 KiB cap and theops_prefix (3.1). Also: the trustedopexecutable with checks on every ancestor and execution of the resolved path, never aPATHsearch (3.4);op_subprocess_envas its own env builder.op read --no-newline --no-color --cache=false --config <private dir> -- <ref>runs with stdin/dev/null, bounded stdout/stderr, a 10 s timeout and kill+reap on abnormal end. At most two processes run at once, with single-flight. Failures are typed and never echo stderr or argv.SourcedValue, configs recordcredential_sources, and the manifest recordsentry_originandextra_env_sources. Only user-store credentials resolve, plus the own env of servers that opt in from an operator source (resolve_secret_refs). References from the environment,~/.env(which still shadows the store), project files, tenants, interpolation, or a remote header (3.2.7) are refused. Own-envop://values and ownOP_SERVICE_ACCOUNT_TOKENpass through verbatim unless the server opts in. References are never published intoos.environ.OP_*control names are never loaded, are stripped from inherited env, and are refused bysecrets set/syncandauth_connect.config_changed). This applies to connect, connect_all, restart (a failure leaves the running instance), lazy start, reconnect,gateway.refresh(keeps a server whose lookup fails), install-and-run,install_server,verify_installationand the update probe. A missed path fails closed withresolution_required. Typed failures are never retried. The npm identity gate sees key names with empty values. Static failures (grammar, source, token file) are classified at load time without callingop.process_output(including the summary), resources/prompts,sanitize_auth_diagnostic,exception_text,last_error, update-probe output, installer output, child stderr, downstream catalog text, and log rendering (getMessage,formatException,Formatter.format, plus a root-logger filter).secret_refscapability (3.10) on/health(names only while HTTP auth is off) andgateway.health, evaluated per request.pmcp secrets set NAME op://...writes only to user scope, only a supported reference, and only once the serving gateway reports the capability and does not answer NAME from env or~/.env.PMCP_AUTH_TOKENstopspmcp --transport httpbefore it binds; otherPMCP_*references are dropped with a warning.scripts/op_live_compat.py: the operator-run, value-free live compatibility check (P2 merge gate, not run here).Verification (dev0, narrow,
-n 2, isolated HOME; no full suite)tests/test_secret_refs_487.py: 151 tests using a fakeopexecutable (records argv/env/cwd/stdin; canned values, failures, hang, overflow). Never touches the realopor 1Password.ruff check,ruff format --checkandmypy src/pmcpare clean.Full suite: hosted CI.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.