Repository navigation
Description
Guardrail class: G2 (data exfiltration: secrets).
Context
Delivered prerequisite outputs: #1651, #1649 (PR #1723) and #1708 (PR #1738). Their outputs remain relevant; they are no longer active blockers.
Decision: docs/decisions/governed-writable-workers.md ("Protected paths", under ".env* is masked"). The brain template keeps API keys in a gitignored .env at the brain root (template .gitignore). Current main already masks root .env* files in turn workers; environment and native-state credential removal remain unfinished. See the current-source handoff below.
Scope
- Audit first. Find which in-worker code paths read the brain's
.env: Bun's automatic.envload when the CLI runs with the brain as its working directory, and any provider key lookups in core. Record which keys each first-party command needs. - No keys in turn workers. A turn worker receives no provider key from
.envor from the environment. A CLI command that needs an unrelayed provider is refused with a namedprovider_unavailablegovernance event (a roadblock) that names the provider. Where core can degrade, it does: hybrid search falls back to keyword search. The metered-relay sibling issue restores provider access without keys. - Mask. Each present
.env*file at the brain root is mounted as--ro-bind /dev/null <path>ingovernedandstrictworkers. - State it. The capabilities note says that secrets are hidden.
Out of scope
- Host credentials outside the brain (backends: the worker sandbox leaves no persistent writable place for scratch, workspaces or file outputs #1626's
$HOMEoverlay). - Routing inference through the relay (egress sibling).
Acceptance criteria
- In a worker, reading
.envreturns empty, and the environment holds no fixture key.brain searchwith a keyed fixture embeddings provider falls back to keyword results and writes aprovider_unavailablegovernance event. An integration test with a fixture key covers this. - The audit result is committed in
docs/hosting/agent-workers.md: which keys, and which commands need them. - Mutation receipt: drop the mask and the empty-read test fails.
Verification
Integrated worker tests on a supported Linux host, then bun run check:pr --base origin/main.
Contract impact
None.
Prerequisite output: #1665 (reopened by explicit maintainer instruction on 2026-10-18; ordinary-inference delivery remains incomplete).
Updated 2026-10-12: removed completed blocker declarations, retained delivered-output context and all remaining prerequisites; readiness and existing rulings preserved.
Current-source readiness handoff — 2026-10-17
Reviewed fetched main 5c670c6f93842717c9a3723606ebcbd7aa52406f in an isolated checkout. The adapter/server/SDK source is unchanged from 2a0b77f675da2f01c32adba3f4920650a5ee09fa. No open implementation PR with an inference/OAuth/credential/egress title or a 1665/1666 branch was found. No implementation claim is taken by this review.
Delivered masking and remaining exposure
- Root
.env*masking is already delivered (maintenanceEnvMasks,packages/ui-sdk/src/server/worker-launcher.ts:453-518; final ordinary application at :639-645). Verify it here with fresh integrated empty-read and mask-mutation proof; do not claim it as new implementation. - The shared subprocess descriptor still admits provider credentials (
SUBPROCESS_ENV,packages/ui-sdk/src/server/subprocess-env.ts:36-85). Ordinary Pi reads and serializes nativeauth.json,models.jsonand settings (const agentFiles,packages/ui-backend-pi/src/worker-session.ts:96-119) and writes them into worker scratch (initialize,packages/ui-backend-pi/src/worker-entry.ts:91-99). Native auth writeback remains at worker-session.ts:400-401. This is not a credential-free ordinary consumer. - Claude conditionally omits
.credentials.jsononly for explicitly selected host inference (plan,packages/ui-backend-claude/src/worker-state.ts:156-181;spawnNow,packages/ui-backend-claude/src/worker-spawn.ts:118-128). Its prepared relay is conditional onreq.workerSandbox.egressand non-API billing (const preparedEgress,packages/ui-backend-claude/src/turn-runner.ts:374-388); the current native prompt gate rejects non-first-party destinations (:493-510). It does not deliver all supported ordinary routing/custom-origin compatibility. - Restricted autonomous envelopes are not substitutes for ordinary native auth/refresh: Pi's envelope has three API shapes and excludes stored OAuth/command keys (
APIS,packages/ui-backend-pi/src/autonomous-envelope.ts:30-74); Claude's subscription envelope requires a setup token (claudeAutonomousEnvelope,packages/ui-backend-claude/src/autonomous-envelope.ts:28-45). Preserve autonomous authority.
Open prerequisite under retained ownership — 2026-10-18
Blocked by #1665
The existing oauth1665 owner reopened #1665 in the same coordinating session after verifying current main 775eb17aab740fa759c2182f306c38fc17acbcbe and the null-commit manual closure. Its original unfinished ordinary-inference outcome remains owned there. The ownership-only human action is resolved; implementation and qualification remain required. agent-ready plus blocked describes this dependency, with no claim taken on #1666 and milestone 0.42.0 retained.
The prerequisite owner must then deliver and qualify ordinary new/resumed Claude and Pi inference with fictional offline upstreams: no provider credentials in worker environment or native state; supported current/changed/expired stored login and refresh, concurrent refresh/cancellation, native per-request endpoint precedence and exact model/account/usage/billing identity; approved host-owned exact-origin authorization per credential, including positive and refused custom origins, aliases, auth endpoint changes, redirect refusal and cross-credential isolation; command keys/headers inside credentialed maintenance and its exclusion; actual managed-storage createApp/WebSocket integration and retained egress/socket/lifetime proof. The latest #1665 handoff also leaves its complete first-party/socket/exclusion gate and preflight unfinished. Record actual merged main identity and source-bound offline positive/negative/mutation evidence plus complete selected current-head hosted proof. No live/paid call, TLS interception, credential waiver or acceptance reduction is authorized.
After verified prerequisite delivery, reassess main and resume only #1666: complete the first-party CLI key/command audit in docs/hosting/agent-workers.md, truthful named provider_unavailable refusals and keyword-search fallback, capabilities disclosure, original integrated keyless/empty-read/mask-mutation proof, focused preflight and selected hosted proof. #1673 paid CLI relay/metering remains separate and downstream.
Updated 2026-10-18: restored the canonical open dependency after retained-owner reconciliation. Earlier dated closure/ownership receipts below are historical and no longer describe current readiness.
Decision (maintainer, 2026-10-16): Implement the host-held Claude OAuth resolver, including ownership of stored-login refresh, as recommended in the architecture prompt. This changes refresh placement and requires a durable decision amendment plus offline compatibility/security proof before activation. Preserve supported ordinary stored login, per-request endpoint/model/account/billing identity and credential-free workers. Qualify new/resumed/changed/expired credentials, concurrent refresh, cancellation and negative secret scans with fictional offline upstreams and meaningful mutations. Pi retains its supported native auth runtime and endpoint precedence; command-sourced credentials remain inside the credentialed maintenance boundary. No paid/live provider call, credential waiver or acceptance-criteria reduction is authorized. PR #2182 remains transport-only until qualification and integration are complete.
Approved custom-origin credential authority — 2026-10-16
The maintainer approved explicit host-owned origin authorization for forwarding stored Claude OAuth to a non-first-party inference origin. First-party inference remains allowed. A custom selected destination must match an explicit authorization in trusted host configuration for that credential; project or worker endpoint settings alone do not authorize the bearer recipient. Refuse an unapproved custom origin before credential release, rather than substitute a different destination. Validate exact canonical scheme/host/port origins, preserve native endpoint precedence as a routing fact, refuse redirects, and qualify configured/managed negative cases and secret absence offline. This settles the separate destination-authority question; the earlier host-held refresh ruling remains unchanged.
This decision authorizes implementation and compatibility/security qualification. It does not activate ordinary inference, waive any original acceptance criterion, authorize TLS interception or a live provider call, or unblock #1666 before #1665 delivers its remaining prerequisite. At the time of this ruling, #1665 was open/claimed and #1666 awaited its output. The current readiness handoff above supersedes that historical tracker state; the ruling remains binding.
Approved Pi custom-origin credential authority — 2026-10-17
Decision (maintainer, 2026-10-17): Pi OAuth forwarding to a non-first-party inference origin requires explicit host-owned exact-origin authorization per credential. Native model settings, including files aliased into the writable brain, select routing but do not authorize the stored bearer recipient. Preserve native endpoint precedence and validate the actual selected destination, including auth-supplied endpoint changes, against trusted host authorization for that credential before forwarding it. Match canonical scheme/host/port origins exactly; refuse an unapproved destination without silently substituting another origin. Redirects must not transfer the credential to a different recipient.
This settles the Pi-only origin-authority decision. It preserves native auth/refresh, model/account/usage identity and the existing command-maintenance/exclusion boundary. No ordinary activation, live or paid provider call, credential waiver or acceptance-criteria reduction is authorized. At the time of this ruling, #1665 remained open/claimed for implementation and offline qualification. Its reopened state and still-undelivered prerequisite are reconciled in the readiness handoff above; this ruling remains binding. The earlier Claude host-held refresh and custom-origin rulings remain unchanged.
Historical independent readiness read-back — 2026-10-17
Fresh review at fetched main 0d780605fe1ea9a281cce947b1f0074f3f3e7acc confirms the existing handoff. #1665 remains closed and assigned under its retained claim; its latest continuation still explicitly leaves ordinary activation and native/security qualification unfinished. No open PR with a 1665/1666 branch or inference/OAuth/credential/egress title was found. Ordinary Pi still serializes native auth.json, and Claude's prepared relay remains conditional and first-party gated at the source locations above. This review does not take ownership of the prerequisite.
A bounded offline real-process diagnostic imported the production filterSubprocessEnv directly, supplied only fictional provider credentials for the agent audience, and launched a real Bun child with that filtered environment. SUBPROCESS_AGENT_PROVIDER_ENV_REACHES_REAL_CHILD passed (1 test, 2 assertions): OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY and CLAUDE_CODE_OAUTH_TOKEN all reached the child. Run through bun run test with the repository network preload; no live provider or credential values were printed. This establishes the shared subprocess admission behavior, not full sandbox/native-turn integration, empty-read/mask mutation proof, or issue completion. The initial attempt to use the test preload in bun -e failed at its test-only afterEach registration; that harness error is excluded from behavioral evidence, and the corrected test-runner control passed.
The exact owner action and resume evidence above remain unchanged. No claim, implementation, PR, merge, readiness-label change or acceptance reduction is made by this review. needs: human remains for prerequisite ownership reconciliation; milestone 0.42.0 is preserved.
2026-10-18 explicit continuation: the maintainer instructed reopening and finishing #1665. It is open under its retained coordinating claim; the #1665 declaration above remains the active dependency. The newer closure was superseded by that instruction, not by delivery evidence.
2026-10-22: reworded prose mentions of other dependencies so the declaration lines alone name this issue's blockers. No dependency changed.
2026-10-22 dependency check after the #1665 stack merged (086db5b20): the #1665 dependency declaration stays. Only governed and strict Claude subscription turns on managed-storage hosts are now credential-free relay consumers. Removing provider keys from turn workers still needs #1665's remaining items: Pi's ordinary relay consumer (Pi workers still receive native auth.json, packages/ui-backend-pi/src/worker-entry.ts:96-99) and API-key Claude profiles through the relay. Hosts without managed native storage (#2654) keep today's inference credentials under the 2026-10-22 activation ruling; inference routing stays out of this issue's scope.
Activity
schlessera commentedon Oct 12, 2026
Claim:
secrets-1666-20261012-78381f66onfeat/1666-worker-secrets-78381f66, preparing independent source and keyless tests on immutable #1723 head3eb4fc39ef8778ff978249480fa4edb4ef68731f. The coordinating session authorizes this preparation while #1649 remains blocked; final foundation/admission/adapter integration and merge still require its corrected proof and delivery. Preserve supported interactive inference, native login/custom profiles, host-held credentials and the separate maintenance interim ruling. No real provider calls, namespace-bypass investigation or metered-relay scope expansion.schlessera commentedon Oct 12, 2026
Unblocked: #1649 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Oct 12, 2026
Deferred implementation handoff — 2026-10-13
Releasing claim
secrets-1666-20261012-78381f66under the maintainer's main-flow-first priority. #1649 is delivered in #1723; #1708 is delivered in #1738. This issue remains open and is not claimed delivered by those changes or by #1753. Its milestone and acceptance criteria remain unchanged.The isolated preparation retains keyless failing-first fixtures for inherited provider credentials and Pi initializer serialization; no production implementation, push or PR was made for this issue. Those receipts were captured on an earlier foundation candidate and must be reassessed against current main before resuming. Current delivered masking is not proof that provider credentials are absent from worker environment or native session state.
Resume by checking ordinary interactive inference, native authentication and supported custom-provider behavior together with the credential boundary. Removing credentials alone would break those flows; moving brain-controlled provider code onto the host would violate the existing worker-only execution decision. Supported host-held inference and truthful keyless CLI degradation remain the unfinished work. No new security ruling, restricted provider set or architecture decision is selected by this handoff. Paid CLI metering (#1673) remains separate.
15 remaining items
schlessera commentedon Oct 18, 2026
Unblocked: #1665 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Oct 23, 2026
Claim:
secrets-1666-20261023-044on branchfeat/1666-worker-env-secrets-044, starting from main48364d94fnow that #1665 has merged.Plan: governed and strict turn workers stop receiving the
brainCLI's provider keys. They keep only their own unrelayed inference credential, plus any name an operator admits explicitly. Abraincommand that needs a withheld key prints a stableprovider_unavailablenotice, andbrain searchdegrades to keyword results. The turn recorder turns each notice into aprovider_unavailablegovernance event. The.env*mask is re-proven under real bubblewrap, the audit goes intodocs/hosting/agent-workers.md, and the capabilities note states all of this. Relaying those providers stays with #1673.Citation drift:
maintenanceEnvMasksnow lives inpackages/ui-sdk/src/server/maintenance-env-masks.ts, and the launcher applies it last for non-maintenance workers inworkerCommand. The Pi and Claude credential citations in the body describe the pre-#1665 state.fix(core): name withheld keys in direct provider calls and pinned ima…
CONTRACT: feat(ui-sdk): withhold the brain CLI's provider keys from g…