Documentation
¶
Overview ¶
Package creds manages the credentials that must live in the sandbox (sections 4.9 and 4.11): cloud OIDC token files with SDK configuration, and the Codex subscription bundle on tmpfs with compare-and-swap write-back. Everything else (SCM, AI proxy, console, Claude OAuth) is injected at egress and never enters the box.
Index ¶
- func Dial(rawURL, caBundle string) (devboxv1.SandboxCredentialsClient, *grpc.ClientConn, error)
- type Manager
- func (m *Manager) CodexAuthDir() string
- func (m *Manager) CodexAuthFile() string
- func (m *Manager) CodexInstalled() bool
- func (m *Manager) DetectInBoxLogins() []string
- func (m *Manager) Env() []string
- func (m *Manager) FetchCodex(ctx context.Context) error
- func (m *Manager) InstallCodex(ctx context.Context, cred *devboxv1.InstanceCredential) (bool, error)
- func (m *Manager) PushCredential(ctx context.Context, cred *devboxv1.InstanceCredential) (bool, error)
- func (m *Manager) RefreshOIDC(ctx context.Context) (time.Time, error)
- func (m *Manager) Restore(ctx context.Context, codex bool) error
- func (m *Manager) RunOIDC(ctx context.Context)
- func (m *Manager) Scrub() []string
- func (m *Manager) SetIdentities(ids []*devboxv1.CloudIdentity) error
- func (m *Manager) TokenPath(name string) string
- func (m *Manager) WatchCodex(ctx context.Context)
- func (m *Manager) WriteSDKConfig() error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(rawURL, caBundle string) (devboxv1.SandboxCredentialsClient, *grpc.ClientConn, error)
Dial connects to the gateway's SandboxCredentials service through egress. https URLs use TLS with the sandbox's trust bundle (egress intercepts and re-signs); http URLs are plaintext.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns sandbox credentials.
func (*Manager) CodexAuthDir ¶
CodexAuthDir is the tmpfs CODEX_HOME holding auth.json.
func (*Manager) CodexAuthFile ¶
CodexAuthFile is the tmpfs auth.json.
func (*Manager) CodexInstalled ¶
CodexInstalled reports whether a Codex credential is installed.
func (*Manager) DetectInBoxLogins ¶
DetectInBoxLogins reports vendor logins made inside the box (they land on the workspace volume and in snapshots).
func (*Manager) Env ¶
Env returns the default identities' environment (for harness and terminal processes).
func (*Manager) FetchCodex ¶
FetchCodex fetches the owner's Codex credential and installs it (harness start for subscription billing).
func (*Manager) InstallCodex ¶
func (m *Manager) InstallCodex(ctx context.Context, cred *devboxv1.InstanceCredential) (bool, error)
InstallCodex writes a Codex credential to tmpfs. Bundles older than the installed version are ignored. It reports whether the credential was applied.
func (*Manager) PushCredential ¶
func (m *Manager) PushCredential(ctx context.Context, cred *devboxv1.InstanceCredential) (bool, error)
PushCredential applies a credential pushed by the gateway (refreshed Codex bundles, OIDC tokens).
func (*Manager) RefreshOIDC ¶
RefreshOIDC fetches current tokens for every identity and rewrites their files. It returns when the next refresh is due.
func (*Manager) Restore ¶
Restore refetches credentials after a resume or restore (Scrub removed them).
func (*Manager) Scrub ¶
Scrub deletes every credential that must not be captured in a snapshot: tmpfs subscription credentials, OIDC token files and SDK caches. It returns the removed paths. Config files (profiles, external_account JSON) stay: they hold no secrets.
func (*Manager) SetIdentities ¶
func (m *Manager) SetIdentities(ids []*devboxv1.CloudIdentity) error
SetIdentities records the box's cloud identities and writes their SDK configuration.
func (*Manager) WatchCodex ¶
WatchCodex watches the tmpfs auth.json for Codex's refreshes and renews the refresh lease before it expires.
func (*Manager) WriteSDKConfig ¶
WriteSDKConfig writes per-identity SDK config and the env file shells and harnesses source:
- AWS: ~/.aws/config profiles (web_identity_token_file), plus AWS_* env for the default;
- GCP: <identity>/gcp-credentials.json external_account configs, GOOGLE_APPLICATION_CREDENTIALS for the default;
- Azure: <identity>/azure.env, plus AZURE_* env for the default.
type Options ¶
type Options struct {
Home string
// IdentityDir holds OIDC token files and SDK config (/run/plural/identity).
IdentityDir string
// AgentAuthDir is the subscription-credential tmpfs (/run/plural/agent-auth).
AgentAuthDir string
// Client returns the SandboxCredentials client (nil while Initialize hasn't provided endpoints).
Client func() devboxv1.SandboxCredentialsClient
InstanceID func() string
Clock clock.Clock
Log *slog.Logger
// Condition reports a daemon condition.
Condition func(typ, severity, msg string, active bool)
// CodexLogin runs `codex login --with-access-token` (overridable in tests).
CodexLogin func(ctx context.Context, codexHome, token string) error
}
Options configure a Manager.