Repository navigation
Credential Transport Abstraction [Spec + Impl] - #11
Conversation
Assisted-By: 🤖 Claude Code
|
Warning Review limit reached
Next review available in: 21 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
📝 WalkthroughWalkthroughCredential handling for OpenShell and SSH workspaces now uses shared ChangesCredential transport migration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Workspace as OpenShellWorkspace
participant Credential as internal/credential
participant Provider as OpenShellProviders
participant Adapter as OpenShellClientAdapter
Workspace->>Credential: Detect and resolve credentials
Workspace->>Provider: Ensure mapped provider
Workspace->>Credential: InjectOpenShell credentials
Credential->>Adapter: Execute or upload credential data
Adapter->>Provider: Delegate OpenShell SDK operation
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Applied fixes from bot review comments: - Comment #3541838890: Remove accidental test artifact nonroot-write.txt - Comment #3541855097: Error on explicit auth mode mismatch instead of silent continue - Comment #3541855104: Include UnsetVars in credential injection gate - Comment #3541855119: Fix Vertex test setup in spec to match assertion - Comment #3541855124: Align FR-007/FR-008 with actual migration target Assisted-By: 🤖 Claude Code
…specs Replace hardcoded credential profile maps (KnownProviderProfiles in openshell, BuildCredentialSet/detectAuthMode in ssh) with the shared internal/credential package using agent-declared CredentialSpec data. Key changes: - OpenShell credential flow uses credential.Detect() + credential.Resolve() with OpenShellClientAdapter bridging the SDK client interface - SSH credential flow uses credential.DetectAll() + credential.InjectSSH() with legacy fallback branch removed - 886 lines of deprecated code removed from openshell/credentials.go and ssh/credentials.go - Explicit auth mode mismatch now errors instead of silent continue - UnsetVars included in credential injection gate Spec: specs/079-credential-transport/ Assisted-By: 🤖 Claude Code
8f99f09 to
d61453f
Compare
| case "api": | ||
| providerType = "claude" | ||
| creds = make(map[string]string) | ||
| for k, v := range resolved.EnvVars { | ||
| creds[k] = v | ||
| } |
There was a problem hiding this comment.
🔴 All credential environment variables are sent to the cloud provider instead of just the API key, potentially breaking provider creation
All resolved environment variables (including optional model-override flags) are copied into the provider credentials map (creds[k] = v at cc-deck/internal/ws/openshell.go:295-296) instead of only the API key, so the OpenShell provider receives unexpected keys like model overrides that it was never given before.
Impact: Provider creation may fail or behave unexpectedly when it receives unrecognized credential keys that the old code never passed.
Old code only passed the API key; new code passes everything
The old code built provider credentials via openshell.ResolveDefaultEnvVars("claude") which returned only ["ANTHROPIC_API_KEY"] (the DetectVars for the claude profile). The new code calls credential.Resolve(selectedSpec) which resolves ALL env vars in the spec (including optional ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL from cc-deck/internal/agent/claude.go:169-171), then mapToOpenShellProvider at lines 294-297 copies the entire map into provider credentials.
Additionally, these same env vars are also injected into the sandbox shell rc files via credential.InjectOpenShell() at line 412, resulting in double injection: once through the provider and once through shell rc files.
The fix should filter the credentials map in the "api" case to only include ANTHROPIC_API_KEY, matching the old behavior. The remaining env vars are correctly handled by the InjectOpenShell call later.
| case "api": | |
| providerType = "claude" | |
| creds = make(map[string]string) | |
| for k, v := range resolved.EnvVars { | |
| creds[k] = v | |
| } | |
| case "api": | |
| providerType = "claude" | |
| creds = make(map[string]string) | |
| if v, ok := resolved.EnvVars["ANTHROPIC_API_KEY"]; ok { | |
| creds["ANTHROPIC_API_KEY"] = v | |
| } |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Implementation of Credential Transport Abstraction. Migrates all credential detection and resolution from hardcoded profile maps to the agent-declared CredentialSpec model through the shared
internal/credentialpackage.Key changes:
KnownProviderProfilesmap fromopenshell/credentials.goBuildCredentialSet/detectAuthModefromssh/credentials.gocredential.Resolve()+credential.InjectOpenShell()credential.DetectAll()+credential.InjectSSH()OpenShellClientAdapterto bridgev1.ClientInterfacetocredential.OpenShellClientArtifacts
specs/079-credential-transport/spec.mdspecs/079-credential-transport/plan.mdspecs/079-credential-transport/tasks.mdAssisted-By: 🤖 Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation