Skip to content

Add opt-in host credential seeding for agent VMs#40

Merged
jhrozek merged 7 commits intomainfrom
inherit-credentials
Mar 16, 2026
Merged

Add opt-in host credential seeding for agent VMs#40
jhrozek merged 7 commits intomainfrom
inherit-credentials

Conversation

@jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Mar 13, 2026

Summary

  • Host credential seeding — New --seed-credentials flag (and auth.seed_host_credentials config) opts in to reading OAuth tokens from the host (macOS Keychain or ~/.claude/.credentials.json) and pre-populating the VM credential store. Eliminates the need for browser-based OAuth on first run inside the VM.
  • Onboarding skip — Set hasCompletedOnboarding in .claude.json so Claude Code skips the interactive wizard inside headless VMs.

Credential seeding design

Each agent gets a Seeder implementation (domain interface in pkg/domain/credential). ClaudeCodeSeeder reads the host Keychain/file, compares expiresAt with stored credentials, and writes only if fresher. The Store interface is extended with SeedFile, ReadFile, and OverwriteFile to support individual file operations needed by the seeder.

Security constraints:

  • Opt-in only (default disabled)
  • seed_host_credentials in workspace .broodbox.yaml is ignored (security warning printed)
  • Credential size bounded to 64 KiB
  • Keychain output trimmed before JSON validation
  • Atomic writes (temp file + rename)

jhrozek and others added 7 commits March 13, 2026 19:53
Extend the Store interface with SeedFile (write-once), ReadFile, and
OverwriteFile methods so callers can access credential files through
the interface instead of reaching around via FSStore.baseDir. Extract
shared path validation into a resolvePath helper. OverwriteFile uses
atomic temp-file + rename matching the existing extractFile pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Define CredentialSeeder with Seed(store Store) error so each agent can
own its host credential seeding logic. Implementations will live in
infra and be wired by the composition root.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the SeedClaudeCodeCredentials function with a ClaudeCodeSeeder
struct that implements the domain CredentialSeeder interface. Uses
Store.ReadFile/OverwriteFile instead of reaching around FSStore.baseDir.
Trim Keychain output, bound credential size, and make host credential
reader swappable for testability. Tests exercise Seed() end-to-end.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add SeedHostCredentials to AuthConfig (opt-in, default false) with
--seed-credentials CLI flag. Local workspace config values are
explicitly ignored in MergeConfigs to prevent supply-chain attacks.
Security warning surfaces override attempts to the user.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract agent-to-seeder dispatch into credentialSeederForAgent switch
function returning credential.CredentialSeeder interface. Seeder
selection lives in the composition root; failure is non-fatal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Skip the interactive setup wizard which cannot complete inside a
headless VM by setting hasCompletedOnboarding in .claude.json during
MCP config injection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jhrozek jhrozek changed the title Add opt-in host credential seeding and MCP authz profiles Add opt-in host credential seeding for agent VMs Mar 16, 2026
@jhrozek jhrozek merged commit ec44f1e into main Mar 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants