Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-claude-shared-credentials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Claude auth on per-UID hives: a Claude Code token refresh writes a temp file and renames it over `~/.claude/.credentials.json`, which replaced the per-agent symlink to the shared login with a private 0600 file; the refreshed token (and the rotated refresh grant) never reached the shared credential and the fleet logged out about every eight hours. The hive now detects the replaced link at agent launch, every 5s from the credential watchdog (`HIVE_CLAUDE_CREDENTIAL_BRIDGE_INTERVAL`) and after a dashboard sign-in, reads the agent's private file as its owner through `su-exec` when the server cannot open it, publishes the newer usable token into the shared login (the previous shared file is kept as `.credentials.json.stale-<ts>`), moves the private copy aside and restores the link. Per-agent `~/.claude` memory stays isolated; only the login is shared, with no operator switch. Audited as `claude_credential_rebridged`. Also hardens the shared-home permission guard and credential promotion against non-regular files: shared logins and CLI configs are written through a randomly named temporary with fd-based mode/owner, the root guard only repairs regular files in regular directories, and the shared dot-dirs get the sticky bit.
2 changes: 2 additions & 0 deletions src/crux/agent/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const (

AuditCopilotTokenMissing = crux.AuditCopilotTokenMissing
AuditClaudeTokenMissing = crux.AuditClaudeTokenMissing

AuditClaudeCredentialRebridged = crux.AuditClaudeCredentialRebridged
)

// auditActorSystem attributes an event to the hive process itself rather than
Expand Down
636 changes: 636 additions & 0 deletions src/crux/agent/claude_credential_bridge.go

Large diffs are not rendered by default.

Loading
Loading