Credentials
Crewship encrypts secret credential material at rest with AES-256-GCM. Runtime delivery depends on the credential type and CLI adapter: supported provider paths use secretless sidecar injection, while other credentials are delivered through the agent environment or/secrets files. The matrix below makes that
boundary explicit.
Credential Types
Canonical list ininternal/api (CredentialType constants). The manifest validator accepts any of these strings on a credentials[].type: field; UI and CLI use the same set.
Provider logins
A provider login is the seat an agent pays for its model with — a Claude Max setup-token, a ChatGPT plan, a metered OpenAI key — as opposed to a secret an agent uses (a GitHub PAT, a DB password). It has an owner, a plan, an expiry and, where the provider has one, a refresh flow that Crewship runs for you. The design is indocs/prd/provider-logins.md.
Creating one. POST /api/v1/credentials with type: PROVIDER_LOGIN, a
provider from ANTHROPIC, OPENAI, GOOGLE, CURSOR, FACTORY,
XAI, GROQ, OPENROUTER, DEEPSEEK, MOONSHOT, ZAI, MINIMAX,
OPENCODE, OPENCODE_GO, ZAI_CODING_PLAN, an
optional mode (subscription | api_key, inferred from the value when
omitted) and value = whatever you have: the output of claude setup-token,
the whole ~/.codex/auth.json that codex login wrote, or an API key. The
server splits it into the value (access token / setup-token / key) and the
parts refresh_token (secret, sealed), id_token (secret), account_id,
plan, expires_at, mode. A value the CLI would refuse — a bare token
where Codex wants the file, an auth.json without id_token — is refused at
submit time with the reason.
CLAUDE_CODE_OAUTH_TOKEN for
an Anthropic seat, a rendered $CODEX_HOME/auth.json with a placeholder
refresh token for a ChatGPT seat, the sidecar CredStore (or the adapter’s env
var where there is no endpoint override) for an api_key login. No part is
ever exported — <SLOT>_REFRESH_TOKEN does not exist in any container, on
any delivery path — and a login is never a /secrets file.
The login object. Every credential row that is a login — the type
itself, and the older AI_CLI_TOKEN / API_KEY rows of a model provider —
carries login with mode, provider, plan / plan_label, the owner,
expires_at, refresh (supported, status, last_at, next_at,
error), delivery (env or file and its target) and pays_for (how
many agents and crews it reaches through grants and bindings). GET /api/v1/credentials?kind=provider_login lists only those rows; GET /api/v1/agents/{id} carries pays_with, the login paying for that agent’s
adapter.
Refresh. Crewship uses the ChatGPT token’s reported expiry. Refresh tokens
can rotate on use, which is why refreshing is centralised: the server
renews the token from the sealed refresh token 24 hours before expiry, and
before any run start with less than 48 hours left, with one refresh in flight
per login at a time (a second request answers 409), a five-minute backoff
after a failure, and after three consecutive failures — or one the provider
calls permanent — refresh.status = needs_relogin plus an inbox message to
current workspace administrators. Notification visibility follows the current
role, even if the person who originally connected the account is later demoted.
A successful refresh re-renders the file into the running
containers of every Codex agent the login pays for. POST /api/v1/credentials/{id}/refresh / crewship credential refresh forces one
now. A Claude setup-token and an API key have no refresh flow
(refresh.supported = false); the expiry badge is all there is.
Reveal. A login that carries a refresh token is SEALED: nothing on it
can be revealed, by any role. The secret parts are never returned by any read
path regardless of classification.
Custom Fields (multi-part credentials)
A credential’s own value is a single secret. Plenty of credentials are not one secret: AWS static credentials are an access key id, a secret access key and a region; a service-account credential is a blob plus a filename; a login may carry a TOTP seed, a passphrase, a host or an account id. Rather than a column per shape, a credential can carry custom fields — any number of named parts, each of which is either secret or plain:
Plain fields are cleartext on purpose, for the same reason
credentials.username is: an identifier is not a secret, and storing it in the
clear lets the UI search and sort without decrypting every row while keeping
the AES-GCM surface small.
There is no way to read a secret field’s value back — not through the API, not
through the CLI. crewship credential reveal is the single disclosure path and
it applies the full reveal ceremony; rotating is usually what you actually
wanted (see Rotation Permissions).
set is an upsert: it creates the field, and replaces the value if the key is
already there. Omitting --plain stores the field encrypted — the default is
the safe one, because a field whose secrecy you forgot to state is exactly the
one you cannot afford to publish.
Rules
- Key shape —
lower_snake_case, starting with a letter, at most 64 characters (^[a-z][a-z0-9_]{0,63}$). Lowercase-only because a key becomes an environment-variable name and a file name at delivery time, whereRegionandregionwould collide once either is upcased. - Reserved keys —
value,passwordandusernameare refused. Those live on the credential itself, set through the credential’s own value rather than a field; a second copy under a field would drift away from the first with nothing to reconcile them. - Limits — at most 32 fields per credential, each value at most 64 KiB (the same cap as the credential’s own value).
- Duplicates — one key per credential.
POSTanswers409; the CLI’ssetturns that into an update. - Visibility and role — reading fields uses the same crew-scoped visibility
rule as reading the credential, and writing them requires the same role as
PATCH /api/v1/credentials/{id}(MANAGER and above). A field is never a way around the gate on the credential it belongs to.
How fields reach the agent
Fields are delivered with the credential they belong to, under a name derived from the credential’s own environment variable:SLOT is whatever the credential resolved to on this agent — the env var of
an explicit assignment, the slot of a binding (see “Slots and Bindings” below),
or (when neither exists) the credential’s name. It is never derived from the
field. That is what keeps ten accounts of one provider apart: bind GH_TOKEN
to one GitHub account and GH_ACME to another, and their account_id fields
arrive as GH_TOKEN_ACCOUNT_ID and GH_ACME_ACCOUNT_ID, each next to the token
it describes.
For the AWS credential above, assigned to the agent as AWS:
HOME, PATH, HTTP_PROXY, CREWSHIP_*,
CLAUDE_CODE_OAUTH_TOKEN, the provider base URLs) — the field is dropped,
the variable keeps the value that was already there, and the server logs a
warning naming the credential, the field key, the derived name and the reason.
A field hangs off the slot its credential is delivered under, not the raw
name — a credential called github-acme arrives as GITHUB_ACME, so its
region field arrives as GITHUB_ACME_REGION. A credential whose name yields
no variable at all is not delivered, and neither are its fields: there is no
prefix left to name them with.
Dropping is the deliberate choice: a missing AWS_REGION is one env away from
being diagnosed, while an AWS_REGION holding some other credential’s value is
not diagnosable at all — and the agent will act on it.
Beyond the naming, fields follow their credential exactly:
- Which channel — a file-delivered credential
(see below) gets one
0400file per field under/secrets/<agent>/, with.envmapping the name to the path, the same wayUSERPASSalready produces<envvar>_USERNAMEand<envvar>_PASSWORD. - Secret fields are decrypted at delivery through the same path as the credential’s own value, and they reach the agent’s environment only where that value does. Under Keeper a gated credential’s secret fields are withheld with it.
- Plain fields are cleartext from storage to container. They are identifiers, not credential material, so they are delivered even when the credential’s own value is isolated behind the sidecar proxy — a proxy can inject a key into a request, it cannot tell your CLI which region to use.
- Revocation — a soft-deleted, revoked or expired-lease credential delivers no fields either. There is no path by which a part outlives the whole.
Supported Providers
Credentials are associated with a provider for automatic injection:How Credential Injection Works
On supported reverse-proxy routes, agents never see the raw provider key. The sidecar intercepts the request and injects the credential based on the destination host:- Claude Code —
ANTHROPIC_BASE_URL=http://127.0.0.1:9119→api.anthropic.com. - Codex —
OPENAI_BASE_URL=http://127.0.0.1:9119/openai/v1→api.openai.com(the/openaiprefix keeps it distinct from Anthropic’s/v1/on the shared port, and is stripped before forwarding). - Gemini —
GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:9119/gemini→generativelanguage.googleapis.com(the/geminirouting prefix is stripped before forwarding; the real key is injected as thex-goog-api-keyheader, overwriting the dummy the CLI sends).
Adapter delivery matrix
“No” in this table means the upstream secret stays in the sidecar heap. It does
not mean the request has network-layer containment: a process can still ignore
HTTP_PROXY or open a raw socket. “Yes” means any code running as the agent can
read the value, and because sibling agents share UID 1001, another concurrently
running sibling can read it too. AgentEnvCredentialExposures logs direct-env
cases so the gap is observable rather than silent.
Slots and Bindings — more than one account per provider
A credential’s name is the account (github-acme). The slot is the environment variable the agent reads (GH_TOKEN). They used to be the same string, which meant a workspace could hold exactly one GitHub account: a second one would also have had to be called GH_TOKEN, and credential names are unique per workspace.
A binding connects the two:
workspace, crew or agent.
Resolution order
agent > crew > workspace. The most specific scope that binds a slot wins, and only that one is delivered — an agent never receives two candidates for the same env var.source names the rule that won: agent_grant (an explicit crewship credential assign), agent_binding, crew_binding, workspace_binding, or crew_link — no binding at all, delivered under the credential’s own name.
Credentials with no binding are unchanged. A crew-linked credential named
CREW_TOKEN still arrives as CREW_TOKEN, and an explicit per-agent assignment still uses the env_var_name you chose. Bindings are additive: nothing is renamed, and no existing workspace has to adopt them.What counts as a legal variable name
An environment variable name is uppercase letters, digits and underscores, and does not start with a digit —GH_TOKEN, _PRIVATE, AWS_KEY_2. That is the rule the container enforces, so it is the rule everything here agrees on.
Slots and env_var_name are variables, so they are held to it at write time, and stored in the form the agent will see. You may type a dash or lowercase; the server records the uppercase form and the response shows it:
gh token, 2fa, anything non-ASCII) is a 400 on the request that chose it.
A credential’s name is not a variable — it is the account (github-acme), and it stays whatever you called it. It only becomes a variable when there is no binding and no assignment, in which case the credential is delivered under its own name. When that name is not already a legal variable, it is normalised on the way in — github-token arrives as GITHUB_TOKEN — and crewship credential resolve tells you so:
- The name folds onto one that is taken.
github-tokenandGITHUB_TOKENare two different credentials (names are unique per workspace) that want one variable. The one that asked forGITHUB_TOKENby name keeps it; the other is not delivered. Handing an agent a variable that plausibly holds a different account’s token is the failure this avoids — a missingGH_TOKENis diagnosable in one command, the wrongGH_TOKENis not. - No variable can be derived at all (
my token!). Nothing is invented for it.
One badly-named credential never costs the others, or the run. Before this, a credential named
github-token failed the variable check while its files were being written, and that failure abandoned the whole credential batch — an agent holding an SSH key and a CLI token alongside it did not start at all, and the error blamed the Docker daemon’s version. A credential that cannot be named is now skipped on its own, with a warning naming it.One slot, one credential, per scope
Within a single scope a slot points at exactly one credential. Binding a slot that is already taken in that scope returns 409 Conflict rather than replacing the existing row — silently repointing every agent in a crew at a different account is not something a write should do implicitly. Unbind first, then bind. Binding the same slot in different scopes is not a conflict; that is the whole point.The honest limit
A container has one default identity per tool.gh reads GH_TOKEN and nothing else. Ten crews with ten accounts is fine. One crew that needs two GitHub accounts at once hits the limit: the second account cannot be the default and must get an explicit slot.
gh --hostname, per-remote git config, AWS_PROFILE).
Deleting the scope deletes the binding
Bindings cascade with their owner: deleting a crew removes its crew-scoped bindings, deleting an agent removes its agent-scoped ones, and deleting a credential removes every binding pointing at it. A binding cannot outlive the thing it was scoped to and keep claiming a slot.Approved hosts (delivery precondition)
A person can attach a list of approved hosts to a credential:*.example.com wildcards (at least two labels after the star). Case, one trailing dot and IDN spellings are normalised to lower-case punycode. Ports, schemes, paths, IP addresses, a bare * and wildcards over a top-level domain are rejected, and one bad entry rejects the whole list.
Who can set them
Only a signed-in OWNER or ADMIN, or an unrestricted operator token held by one. A run token, a scoped token and any request that did not pass normal sign-in are refused. Thehosts an agent writes in a credential request are shown in the inbox as a suggestion; nothing copies them here. A person has to run the command above.
What it does
A credential with approved hosts is host-bound. It is delivered to an agent only when both hold:- the agent’s crew is in restricted network mode, and
- every approved host is permitted by the crew’s effective egress allowlist (the built-in model-provider hosts plus the crew’s allowed domains). A wildcard host needs a wildcard of the same or wider reach in the allowlist; an exact allowlist entry does not cover it.
/secrets, no environment variable, no sidecar copy. An unreadable host list, an agent with no crew and an unreadable crew policy also withhold. crewship agent credential-readiness <agent> lists each withheld credential with its hosts and the reason. A credential with no approved hosts behaves exactly as before.
The same rule, from one shared check (internal/credhostgate), applies to these paths that hand a credential’s value to a run or a service:
When a change takes effect
Setting, changing or clearing the list is recorded (credential timeline and the audit log, with the previous and new lists and who made the change). What happens to copies already delivered:- Delivery paths above: the new list applies to the next resolve, that is the next run or config read.
- Sidecar copy of a model key: the sidecar re-checks every 60 seconds against the server’s live credential list. A credential the crew no longer satisfies drops out of that list, and the sidecar discards its copy on the next check. Approving more hosts never adds a copy back; start a new run for that.
/secretsfiles: tightening removes the file from the running containers of crews the credential is no longer deliverable to, best-effort (a stopped container is skipped, and nothing is rewritten while the credential stays withheld). Crews that still satisfy the list keep their file.- Not recalled: an environment variable already set in a running agent process, and a token the agent has already read, stay where they are until that run ends. Narrowing a crew’s allowed domains or switching it to free network is picked up by the same 60-second check and the next run, but does not rewrite files in running containers.
- the loopback-only model-token sync and the model-token pool behind the local IPC socket (the socket is owner-only and is not mounted into crew containers).
api.anthropic.com. Both read only the workspace’s oldest active Anthropic key, so a bound oldest key fails closed even when a newer unbound key exists. Each reads the key of the workspace the request was authorised for; naming another workspace is refused before any key is read. Testing a stored credential (crewship credential test-stored, Test now) is refused with 409 for a host-bound credential, because the test would send the value to the provider’s host or a stored endpoint; clear its hosts to test it. Token refresh follows the same rule: an OAuth2 credential is refreshed only if its token URL’s host is approved, and a provider login only if its provider’s token endpoint (for example auth.openai.com) is approved. Otherwise the stored token is kept until it expires, and a manual refresh answers 409. Connecting or reconnecting an OAuth2 credential is refused the same way (409, or an error page in the loopback flow), because the code exchange sends the client secret to the token URL. Token requests never follow redirects. Live model listing, which any signed-in token can call, sends a key only if it is unbound or approves the provider’s host (api.anthropic.com or api.openai.com), and otherwise shows the built-in model list.
A host-bound credential cannot serve as the governance model or as a Keeper evaluator key. Choosing one as an evaluator key is refused. Choosing one as the governance model is accepted but has no effect: the Keeper degrades to the local judge. If a list is added to a key already in use, the next call degrades the same way, and an evaluator falls back to the server’s own key.
What it does not do
This is a check on the crew’s network policy at delivery time. It is not a control on where a delivered token is used. The token is an ordinary file in the container, and non-model HTTPS goes through the proxy as an opaque tunnel whose headers it cannot read. An agent that holds the file can still send the token to any host the crew allowlist permits, including hosts that are not on the credential’s list. The list also says nothing about the sidecar’s own model-key swap, which already keeps real model keys out of the container. If you need the token confined to particular hosts, narrow the crew’s allowed domains. Per-host injection, where the token never enters the container, is not part of this feature.Priority-Based Selection
TheCredStore (internal/sidecar/credstore.go) selects credentials in three steps:
- The calling agent’s grants: only credentials granted to the agent making the request are eligible. A credential linked to the crew, or bound at crew or workspace scope, is granted to every member; one granted to named agents is eligible only for those.
- Priority tier: among those, credentials with the lowest numeric priority value are selected first (lower = higher priority)
- Round-robin within tier: multiple eligible credentials at the same priority level rotate to distribute load
The CredStore is an in-memory store — credentials are never written to disk inside the container. They are loaded at container startup via stdin JSON from the orchestrator.
One sidecar serves the whole crew container, so the store is shared. Step 1 is what keeps it from behaving as if the credentials were too: the calling agent is resolved from its own per-agent route token, which the orchestrator derives per agent and which cannot be forged — it is an HMAC under a key the container never sees. On the LLM proxy’s provider path the token is derived per agent and per run: the dummy provider key carries a run-bound token, the proxy resolves the requester from it for cost attribution, and a request whose run has already ended is refused before any credential is injected — including after a sidecar restart, because revocation is replayed from the journal-backed run registry. It can be read, though: the crew shares one container and one uid, and each member’s token sits in its own environment and MCP config. This is least privilege within a shared trust domain, not isolation from a hostile peer — a crew is one trust domain by design. An agent that holds no credential for the provider gets
503 no credential available rather than a teammate’s — which matters most for OPENAI_COMPAT, whose upstream comes from the credential, so a crossed credential would have chosen the destination as well as the key (#2052).Credential Delivery Flow
1
Encrypted storage
Credentials are stored in the database encrypted with AES-256-GCM. The format is
v1:base64(IV||AuthTag||Ciphertext) where IV is 16 bytes and AuthTag is 16 bytes.2
Resolution and decryption at runtime
At run setup, Crewship resolves the agent’s explicit grants, scoped bindings and legacy crew links, filters inactive or expired grants, and decrypts the resulting secret material using
ENCRYPTION_KEY.3
Proxy-delivered credentials
Credentials selected for a supported proxy route are sent to the shared crew sidecar as JSON via stdin, not through the agent environment. The sidecar keeps them in its in-memory
CredStore.4
Directly delivered credentials
Credentials that the selected CLI must present itself are delivered through environment variables or
0400 files under /secrets/{agent-slug}/. They are readable by the agent process and are outside the secretless proxy guarantee.5
Use-time injection where supported
For a proxy-routed request, the sidecar matches the destination to a provider and injects the real authentication header. For a direct path, the CLI uses the value it already holds.
Cooldown Management
When a credential receives a429 Too Many Requests response, the CooldownManager (internal/orchestrator/) temporarily removes it from the rotation. This prevents thundering-herd problems when rate limits are hit.
Credential Security Levels
Credentials can be tagged with security levels for Keeper gating:Where the tier shows up in the console
The tier decides what happens when an agent asks for the secret, so it is on every credential surface:- An
L1–L4chip in the Secrets table’s Tier column and in the header of the secret’s own page. A credential whose server did not report a tier showsL?, neverL1: “we were not told” and “unguarded” are different claims. - A Keeper tier filter in the Vault panel, one option per tier.
- A Keeper tier control on the secret’s Access tab (L1–L4), and Change tier for several secrets at once from the table’s selection bar.
keeper.SecurityLevel.Tier() — unknown blast radius is
treated as the strictest tier, not the loosest.
The Vault page
Vault (/credentials) has a panel on the left and the list on the right.
The panel starts with two spaces — Secrets and AI providers (owners and
admins only) — then the Secrets views with their counts: All secrets, Needs
attention, Recently used (used in the last 30 days), Not used and, once a
crew has reported one, Missing tool. The panel’s Filter button opens the
filters inside the panel, under its toolbar: Type, Service, Used by crew,
Classification, Scope, Tag, Assigned to and Keeper tier. Each lists
up to six values and the rest under All N…. Values inside one filter OR
together, the filters AND, and while the block is closed each one in force
shows as a chip you can remove.
On a phone the panel is a sheet from the top bar, and a Secrets / AI providers
switch sits above the list. Keys 1 and 2 switch between the two spaces
(not while you type in a field or a dialog is open), and the Vault remembers the
space you were last in: a plain /credentials opens it again, on any device.
Above the table a health strip counts what needs a person — Rejected
(refused by the service or past its date), Expire within 14 days and Not
used in 30 days — and each tile opens exactly that list.
The Secrets table shows one row per secret: the service mark, the name, the
type and service, who holds it, when it was last used, its tier (and
classification when it is not Standard) and its state — Rejected, Waiting
for approval, Expires soon, Not used or Ready. Broken secrets sort
first, then the most recently used. Rows come 50 at a time (Load 50 more),
and Group: Type splits the table by type. AI provider accounts are not in
this table; they have their own space.
Tick rows to act on several at once (managers and up). Change tier sets one
tier for all of them; Delete (owners and admins) first says what breaks —
the agents that lose the secrets and the routines that reference them — and
deletes only rows that are still on screen. Changing a filter drops the
selection, so a secret you can no longer see is never deleted. If some deletes
fail, the dialog stays open and the failed rows stay selected.
A load failure is shown as an error with Retry, never as an empty vault —
an empty vault invites re-creating secrets that already exist. Filters that
match nothing say so, with Clear filters.
Links into the Vault
What the page shows lives in its address, so a link from another page lands on the same list and a reload keeps it:
A member who follows an AI providers link lands on Secrets with a note that
those accounts are managed by owners and admins. A link to a secret that was
deleted shows “This secret doesn’t exist” with a way back.
One secret, one page
Opening a secret shows its page: the service mark, the name, its state, scope, tier, classification and tags, and the actions Replace value and Give to agents. The page has tabs, and the open tab is part of the address:
A provider login’s page has Overview · Pays for · Activity · Settings.
Give to agents (owners and admins) picks agents, crews or the whole
workspace and the variable name they get the secret under, and writes one
binding per target — the same rows
crewship credential bind --slot writes.
The name defaults to the one the secret already goes by, else the service’s
usual variable. Targets that already have it are shown as such and not written
again; if a target refuses (the variable is taken there by another secret),
the dialog stays open and says which. The value never passes through it. For
other roles the button opens the Access tab.
Replace value asks for the new value and how long the old one keeps working
— No grace, 1 hour, 24 hours (the default) or 7 days — and sends
grace_seconds to POST /credentials/{id}/rotate. Running work finishes with
the old value; new runs get the new one. End grace early calls DELETE /credential-rotations/{id} (crewship credential rotation-cancel <id>), after
which the old value is gone from Crewship. A manager who may edit the secret
but not rotate it replaces the value at once, without a grace period. Crewship
never creates or revokes the key at the service.
The grace window is consumed on a 401. A crew sidecar that boots inside the
window receives the previous value beside the new one — through the same boot
payload, never the agent’s environment — and when the provider answers 401 to
the new value, the sidecar replays the request exactly once with the previous
one. A 403 or a 5xx is not retried, and a second 401 reaches the agent. A
run that succeeded this way is visible as a network.egress journal entry
naming the credential and the rotation. Ending the window early scrubs the value
on the server and a running sidecar forgets its copy after the next successful
reconciliation (polled every minute).
An authenticated ENDPOINT_URL rotated with a grace window keeps serving a
running crew’s model calls with its previous value until the window ends: the
proxy entry is admitted under the real credential ID and the revision of either
the current or the most recent previous value. If the rotation moves the
endpoint to a different host, the running sidecar keeps calling the old host for
that time; End grace early cuts it off at the next admission.
Reveal is explicit and audited. It asks for a reason of at least 20
characters — a shorter one is refused at the field without a request, and the
server’s own refusal (a generic reason, a sign-in that is too old) lands there
too. Reveal for 30 s shows the value once; it hides after 30 seconds, when
you leave the tab or when you close the dialog, and the reveal and the reason
are written to the audit log before the value is returned. Sealed secrets are
never revealed. When reveal is unavailable the Overview names the gate that is
shut — the workspace switch, the MANAGER floor, the credentials:reveal
capability or the SEALED classification.
The audit says who. Every row carries the actor: an agent with the avatar it
has everywhere else in the product, a person with their name, a crew for a
sidecar read, or system for a row nobody signed. Ten events are shown at a
time with the total beside them (10 of 37). Audit and rotation history stay
gated on role: GET /audit is MANAGER+ because it exposes the IPs behind admin
actions, and the Activity tab is not shown below that role.
Folders, sharing grants, external vaults, import from a file and a Workspace
keys inventory are not available yet; the Vault does not show them.
Provider logins
A provider login is not a secret an agent uses — it is the seat an agent pays with: a Claude Max setup-token, a ChatGPT plan, a metered OpenAI or Gemini key. It has an owner, a plan, an expiry and, where the provider exposes them, two quota windows, and Crewship keeps it valid. None of that fits a row that says “ai cli · L1”, so provider logins have their own tab. Provider logins are administrative: only a workspace OWNER or ADMIN sees, creates, edits, refreshes or revokes one — including the olderAI_CLI_TOKEN
/ API_KEY rows of a model provider. Below that role the AI providers space is
empty, crewship credential list --kind provider_login returns nothing, and
any per-id request answers “not found”; a credential.create grant does not
open this door. Delivery to agents is unaffected — the seat still pays for
the agents it is bound to.
The AI providers space
Vault → AI providers shows the model accounts. A health strip counts Accounts (subscriptions and API keys), Need a new sign-in, Pay for nothing and People with an account; the first three open the list they count. The accounts come as cards — brand, name, provider and plan, a state (Ready, Not used, Sign in again, At limit, Expires soon), usage, whose account it is and what it pays for — or as a list (Account, Owner, Pays for, State), which is the default from 13 accounts and can be grouped by provider, owner or account group. Both come 50 at a time. The panel has the views All accounts, Needs attention, Not paying for anything and My accounts, the account groups, and under Filter, in the panel, the facets Provider, How it pays (subscription or API key) and Owner. With one provider chosen the space is that provider’s page: how it signs in, which runners use it, how agents get it, how it renews and which account is the workspace default. Usage bars appear only when the server reports the provider’s windows; until then a card says No usage data yet. Spend per account is not shown. Provider logins are not counted among the Secrets: the Secrets space says “12 secrets” and the AI providers space “5 accounts”. Every olderAI_CLI_TOKEN or API_KEY row with an AI provider shows
in that space too — the server derives its login facts — without migration.
A fact the server does not have is drawn as unknown, never as a number: an
unknown expiry prints ”—”.
Account groups
An account group gathers accounts of one provider and one way of paying in an order of preference. New account group (the + next to Account groups in the panel) asks for a name, the provider and the accounts. Each group has its own page:- Accounts — the members.
- Order — move accounts up or down and save. Every save names the revision
the page read (
If-Match); if someone changed the group meanwhile, the page says so and keeps your order until you reload. - Settings — name, whether accounts of different people may share the group (only with their consent), the members, and Delete group behind a confirmation. Its accounts stay and keep paying for the same agents.
crewship credential pool list|get|create|update|delete.
What each status means
A seat’s page
Opening a row shows, above the usual value, fields and audit sections:- Seat — owner, plan (and that it was read from the token claim), the provider account id, and how it bills (flat-rate seat, or metered per token through the sidecar).
- Quota — both windows and when they reset, or the sentence saying the provider does not expose them.
- Validity & refresh — when the access token expires, the last and next
refresh, and the refresh token shown as SEALED: it never leaves the
server, is never delivered to a container and cannot be revealed. Refresh
now runs one refresh immediately (
crewship credential refresh <id>); a second one while it runs is refused, one at a time by design. A seat with no refresh flow says so — “paste a new token before<date>”. - Delivered to the agent as — the environment variable, or the file in the
agent’s HOME (
.codex/auth.json, mode 0600) rendered with the real access token and a placeholder refresh token, rewritten at every run start and after every refresh, removed on revoke. A subscription seat’s traffic goes through the sidecar tunnel, so model policy is not enforced in subscription mode. - Pays for (its own tab) — the agents whose runner can use the provider,
by crew, each with a switch: on writes an AGENT-scope binding under the
account’s variable (the row
crewship credential bind <name> --slot <VAR> --agent <agent>writes), off removes it. Pay for the whole crew writes one CREW binding, Use as workspace default the WORKSPACE one. An agent uses the account bound to it, then its crew’s, then the workspace default. Owners and admins change these; others see them locked.
403 as an invalid
login — verifying a subscription needs a controlled agent run) and one primary:
Sign in again while it is signed out, else Pay for agents. Sign in
again and Revoke are also on the Settings tab; Revoke asks first.
Adding one, and signing in with a code
Add AI provider is its own dialog with three steps — Provider, Connect, Pays for. The providers are exactly the ones the provider-login API accepts (subscriptions are marked). Connect asks how the seat pays (Subscription or API key), then the login itself, then the owner — the person whose seat it is, defaulting to you; seats are per person under both providers’ terms. Anthropic takes the output ofclaude setup-token; a
key is pasted as a key. Test beside a pasted API key or Claude setup
token asks the provider before anything is saved (POST /api/v1/credentials/test): The key works, the provider’s reason for refusing
it, or — for a provider with no check — that it can’t be checked before saving.
The value is only sent, never shown, and the result is dropped when the value
changes; a passed test is repeated on the last step as Connection tested.
For an OpenAI subscription there are two ways in:
- Import from Codex CLI — paste
~/.codex/auth.jsonfrom a machine wherecodex loginsucceeded. The server splits it into parts and seals the refresh token on save. - Sign in with a code — Crewship asks OpenAI for a one-time code and shows
it, large and copyable, with the page to enter it on. Open that page on any
device, type the code, approve. Crewship polls the provider at the interval
it names; when the sign-in lands the login exists — refresh token sealed —
and the wizard moves on to who pays with it. An expired or denied code offers
a new one. The same flow from a terminal is
crewship credential login --provider OPENAI, which waits and prints the result.
Pays with, on the agent
An agent’s Config tab carries Pays with under the CLI adapter: the seats of the adapter’s provider with plan, owner and status; seats of another provider visible but greyed as “wrong provider” (Codex CLI cannot pay with a Claude login, and the mismatch is said here rather than as a 401 inside a run). Choosing one writes the agent’s own binding, which wins over the crew’s and the workspace’s. If the chosen seat is at its limit and no other seat of that provider is in scope, the row warns that the agent’s next run waits.Account groups (provider pools)
Account groups in the AI providers space put several seats of one provider and one billing mode into a named, ordered set — the shape in which, once bound, a seat at its limit hands its turn to the next. The API and the CLI call the same object a provider pool:crewship credential pool create|list|get|update|delete
(CLI reference,
API reference).
A group is a definition only for now — it does not bind seats to an agent,
grant them or drive failover yet — and it is OWNER/ADMIN-only like the seats
in it. Accounts owned by different people can be grouped only with explicit
consent, because seats are per person under the providers’ terms.
Listing & Filtering Credentials
crewship credential list returns the workspace’s credentials. For large
workspaces it supports server-side filtering and cursor pagination:
--search and --tag are applied on the server. When more results remain and
you didn’t pass --all, the CLI prints the cursor for the next page to stderr;
pass it back with --cursor <value>.
Under the hood these map to the GET /api/v1/credentials query parameters
search, tag, limit, and cursor. The endpoint is backward compatible:
without paginate=true it returns the plain array it always has; with it, the
response is a { "credentials": [...], "next_cursor": ... } envelope
(next_cursor is null on the last page).
The web Credentials page follows the workspace selected in the top-bar
switcher, so users in multiple workspaces can manage each one’s credentials. It
has no table — the left rail is the list; see One credential, one
page.
Adding Credentials
Via the UI
Open Credentials and click Add secret. The flow asks three questions, in this order:- What shape is it — Token, Login, Key pair, SSH key, File or Certificate. The shape decides which boxes you fill; there is no brand catalog to hunt through. Any of the thousands of services out there fits one of these six, and anything else fits a custom field.
- The values the shape implies, plus a name for the account
(
github-acme, notGH_TOKEN— see Slots and Bindings). Parts marked plain in the table above are stored in the clear; everything else is encrypted and never readable again. - Who gets it, and under which variable — the whole workspace or selected crews, then the slot: the environment-variable name the container will see. Leave the slot empty and the credential is delivered under its own name, which is the pre-slot behaviour.
ghp_…, sk-ant-…, AKIA…) picks up the brand
icon and suggests a slot name. That is a hint, not a gate — an
unrecognised value is completely normal and nothing blocks on it.
Choosing the slot requires workspace-admin rights (POST /api/v1/credentials/bindings is OWNER/ADMIN). A MANAGER can still create the
credential; an admin can bind it to a slot afterwards.
Secret values (and OAuth refresh tokens) are capped at 64 KiB per value; ENDPOINT_URL values are capped at 2048 bytes. Oversized values are rejected with a 400 at submit time. A credential may carry at most 32 custom fields.
The Credentials list
The list has a left rail in the same shape as Integrations: Status (everything / needs attention / missing tool) and Tier in the rail itself, then Brand, Shape, Scope, Assigned to and Tag behind theFilter button, each with its own count.
The Readiness column is the one that is not about the vault. It answers
“does the crew’s container actually have the CLI this credential is for?”,
from GET /api/v1/crews/{crewId}/credential-readiness, and it has three
states — not two:
The agent overview asks the other readiness question — “does a credential the
runtime will actually deliver authenticate this agent’s model?” — from
GET /api/v1/agents/{agentId}/credential-readiness, and warns No model
credential only when the answer is missing. It cannot be read off the
agent’s credential list: one crew-scoped GH_TOKEN binding makes that list
non-empty for every agent in the crew, and for CLAUDE_CODE the model key in
the env is a dummy by design (the sidecar injects the real one). The same
verdict is crewship agent credential-readiness <agent>; see the
agent CLI page.
Revealing a value from the UI
The credential detail sheet offers Rotate and show the new value as the primary action and Reveal the existing value… as the secondary one. That ordering is deliberate: most reasons to want a value are really reasons to replace it, and a control that is used rarely is a control that keeps working. The Reveal action only appears when all of the following hold, which is exactly what the server checks:- reveal is enabled for the workspace (Settings → Access & Secrets),
- your membership holds the
credentials:revealcapability — theadminpreset includes it, and an OWNER or ADMIN whose membership has no explicit capability set holds it by default; an explicit set is authoritative, so it can be revoked from an admin and granted to a MANAGER, - your role is MANAGER or above, and
- the credential is not
SEALED.
Settings → Access & Secrets
Workspace-wide policy lives in Settings → Access & Secrets, not on any one credential’s page:- the reveal switch — read by MANAGER and above, changed by the OWNER only (an ADMIN is refused by the API, so the switch renders read-only for them and says why),
- who holds
credentials:reveal, with a warning once it is spread wider than a couple of people, - what each classification means and who may move a credential between them (MANAGER+ to raise, OWNER/ADMIN to lower — lowering is journaled).
Via the CLI
--crews accepts crew slugs or IDs and is the CLI equivalent of the UI’s crew-scoping picker (it writes the credential_crews junction). Supplying crews sets the credential’s scope to CREW; omit it for a workspace-wide credential. --scope WORKSPACE|CREW is available to set the scope explicitly, but it’s normally inferred from --crews.
--scope only accepts WORKSPACE or CREW (case-insensitive) and is rejected client-side otherwise; on credential update it also rejects an empty value. Note that the server always derives scope=CREW when --crews resolves to a non-empty list, even if --scope WORKSPACE was passed explicitly — the CLI prints a warning to stderr in that combination, but the server’s derived scope wins.
Sign in with a code
A subscription login for a model provider does not have to be pasted. For OpenAI (a ChatGPT Plus / Pro / Business plan, used by the Codex adapter) the server can run the provider’s device-code sign-in itself:auth.json that codex login would have written, and
stores it as a PROVIDER_LOGIN credential owned by you, named after the plan
and the account (ChatGPT Plus · jana@unify.cz). The command then prints the
credential the way credential get does. Assign it to a Codex agent like any
other login; it is delivered as a rendered file whose refresh token never
leaves the server — see Codex CLI.
Because the server does the waiting, a closed terminal does not lose the
sign-in: --no-wait prints the code and a device id and returns, and
crewship credential login-status <device-id> reports pending, complete,
expired or denied later. A code is valid for 15 minutes, and a server
restart in the middle resumes the wait. Starting a sign-in requires the
workspace OWNER or ADMIN role; credential.create alone does not grant
provider-account access. Starts are limited to five per person per ten minutes.
Enter the code only for a sign-in you started yourself: a code shown to you
by a page or another person is how an account gets bound to a workspace it
does not belong to.
Via Seed Data
For development, set environment variables before seeding:sk-ant-oat) vs API keys and creates the appropriate credential type.
Rotation Permissions
Rotating a credential (and cancelling a rotation’s grace window early) requires theOWNER/ADMIN role or the credential.rotate member capability. Granting that capability to a MANAGER or MEMBER lets an oncall user rotate a leaked token without giving them blanket vault access — see the capability list in the Workspaces API reference.
Credential Assignment
Every credential belongs to a workspace, but an agent’s delivery set is resolved from three sources: an explicit per-agent grant, the winning agent/crew/workspace binding for a slot, and a legacy crew link. Explicit grants take precedence for the same credential. Provider-based auto-assignment creates explicit grants in selected agent-creation flows; it is not the only way a credential reaches an agent. Two explicit-assignment modes exist:Short-lived leases (TTL)
An assignment is normally a standing grant — long-lived, reused across every session until it is unassigned. A stolen standing grant stays valuable indefinitely. A lease flips that: the grant is issued with a short TTL, and once it lapses it is refused at credential-injection time (fail-closed) — the agent must be re-granted access. The durable secret always stays in the vault; the grant is the only thing that expires. Add a lease by passing--ttl to credential assign:
--ttl accepts Go durations (30m, 2h, 24h), capped at 30 days — a
multi-month “lease” is a standing grant in disguise and is rejected. Omit --ttl
for a standing grant.
Enforcement is at the injection point, not just the UI, and it covers every
path that hands a grant’s plaintext to an agent:
Server-side gates decide what to deliver at the instant of delivery. A
container then holds that plaintext for its whole life, so leases also travel
with the delivered credential:
- The boot payload carries each credential’s
lease_expires_at. - The sidecar’s credential store refuses a credential whose lease has lapsed the moment it lapses (not on the next sweep), and the credential reaper evicts it from memory within one ~60s interval so the plaintext stops being resident.
- Unlike revocation — which needs a
crewshipdround-trip and therefore fails open, so a transient blip cannot nuke a working key — lease expiry needs no round-trip and therefore fails closed. An unreachable server is not an excuse to keep serving a lapsed lease.
The lease lives on the per-agent grant. A credential whose
scope is
WORKSPACE (or that is granted to a crew via credential_crews) is still
reachable through that path, which carries no TTL — a lease narrows one
agent’s grant, it does not retro-scope a workspace-wide credential. Scope the
credential to the agents that need it if you want the lease to be the only way
in.EXPIRED <timestamp>. SOURCE says which event
minted it — see the next section.
Auto-issued leases (on approval)
--ttl leases one grant by hand. Auto-lease does it for you: with a TTL
configured for the workspace, every approval re-issues the grant as a lease, so
credential access decays instead of accumulating.
SOURCE in parentheses) when:
- the Keeper ALLOWs a
/keeper/requestor/keeper/executecall (keeper_allow), or - a human approves an agent-proposed
CREDENTIALescalation (escalation_approve).
- Opt-in. Default off. Nothing changes until you set a TTL.
- L3/L4 only. L1/L2 self-service credentials are delivered to the agent for the whole run (they are how it calls its own model), so they are never auto-leased — expiring one mid-run would break the agent’s own work rather than contain an attacker.
- Never shortens a longer lease. A grant you leased with
--ttl 7dkeeps its 7 days; only a standing grant or a shorter lease is rewritten. - Bounded. Minimum 60s (a shorter lease can lapse inside Keeper’s own evaluation, denying the request that authorised it), maximum 30 days.
LEASED row to the credential’s audit timeline and a
credential.lease_issued entry to the journal, carrying the source, the
resulting expiry and the authorising request id — so “why did this credential
stop working at 14:32?” is answerable.
With auto-lease on, approving an agent-proposed credential escalation also
creates the proposing agent’s grant (leased) if it had none. With auto-lease
off, approve behaves as it always has: it activates the credential and creates no
grant.
Asking a human for a credential
An agent that needs a secret only a human has — a database password, a partner API token — asks for it. It raises aCREDENTIAL escalation whose metadata
names the credential and says what it is for, and carries no value:
-
The Keeper judges the ask first, before anything is staged. It sees the declared
name, type, tier and purpose and the agent’s recent conversation — never a value, because
an ask has none — and answers with the same judgement it applies to credential access:
- ALLOW → the ask is staged and routed to a human, as below.
- DENY → nothing is staged, no inbox card, no human interrupted; the agent’s
/escalatecall returns{"status":"DENIED","reason":"…"}and the denial is recorded in the journal. The agent is expected to read the reason and move on, not re-ask with reworded wording. - ESCALATE (and any judge outage) → staged and routed to a human as normal, with the judge’s note attached to the card so the reviewer sees why it was flagged.
-
A credential named
PG_PASSWORDis staged in the vault immediately, in statusREQUESTED— the name, type, tier and purpose the agent declared, and no value. It is marked handle-only (below). Like aPENDING_APPROVALrow it is filtered out of every delivery path, so nothing can use it yet. The escalation links it. -
The inbox card says Credential requested: PG_PASSWORD and, on the crew’s escalations
panel, offers a masked input. What the human types goes straight into the vault
—
POST /api/v1/escalations/{id}/supply, or from a terminal:The value is read from stdin only. There is no flag for it, so it never lands inargv, the process table or shell history. -
In one transaction the credential becomes
ACTIVE, is granted to the asking agent under the name it asked for (leased, when the workspace has auto-lease on), and the escalation is resolved with nothing in its resolution column. -
The agent’s
/escalatecall returns:A handle, never the value. The agent uses it through/keeper/execute— the value is injected into that one command inside the container and scrubbed from its output — exactly like a Keeper-guardedSECRET.
security_level in the ask is the agent’s proposal; the approver sees it and the
human supplying the value can override it (--security-level). hosts and
purpose are review metadata for the approver — shown on the card, stored as the
credential’s description, not enforced: there is no per-credential egress policy, and
a list that looked enforced but was not would be worse than none.
A late answer still lands. The agent waits up to 5 minutes; the human has 7 days. If
the human answers after the agent moved on, the grant is a row, not a message: the
agent finds
PG_PASSWORD in its .env on its next run and does not have to ask again.
This is the property the old flow could not have — a value delivered after the wait
ended had nowhere to go.Handle-only credentials
credentials.handle_only says the agent may use this value, never read it. Every
credential created from an ask is handle-only — the flag is set by the ask and by the
human’s supply, and only there: no create or update field and no CLI flag sets it on
an ordinary credential. It is enforced at the one place every delivery path derives its set from
(loadDeliveredCredentials) — the boot resolver, the peer-query loader and the
sub-agent loader alike — and it does not depend on Keeper being enabled: it is a
property of the secret, not of the instance. A handle-only credential is delivered as
its name with no value, listed in the agent’s [KEEPER] prompt block, and reachable
only through /keeper/execute or the sidecar proxy.
What a CREDENTIAL escalation never carries
/resolverefuses text.PATCH /api/v1/escalations/{id}/resolveon aCREDENTIALescalation answers 400 to anyresolution, approve or reject. The only text a human ever typed there was the secret; the supply endpoint is where a value goes, andapprove/rejectneed no words. Approving an ask that still has no value is 409.escalations.resolutionis never written for aCREDENTIALescalation. It used to hold the human-typed secret, encrypted — a second vault with no tier, lease, rotation or audit timeline, whose one reader handed the plaintext back to the agent. Historical rows now hold the marker[credential submitted]; the ciphertext is gone.- The agent-facing wait body has no
resolutionkey on aCREDENTIALanswer — not an empty one, none. What it has iscredential.
Agent-Proposed Credentials (pending approval)
Agents cannot activate a credential on their own — the lifecycle requires a named human, and the/secrets/{agent-slug}/ files carry no authority — they are plain
0400 copies on the crew tmpfs, and rewriting one does not register anything
in the vault. But an agent that generated a secret for the crew — say
a password for a database it just provisioned — can propose it, and a human approves
it with one click.
The agent raises a CREDENTIAL escalation through the sidecar, carrying the proposed
credential as JSON in the metadata field. Send the body over stdin (--data @-) so the
secret never lands in the shell history or process arguments:
Attribution comes from the presented per-agent bearer token, not the
from
field. Each agent receives $CREWSHIP_AGENT_TOKEN (derived as
HMAC(master, workspace‖agent)) in its environment and MCP config. The shared
sidecar matches it against the crew roster and overrides caller-supplied
identity fields, so changing from alone cannot impersonate a peer and an
unknown token is refused. This is token attribution, not an intra-crew process
identity boundary: siblings share UID 1001 and the process namespace, so one
that reads a peer’s token can replay it and inherit that attribution. A missing
token is refused whenever the crew has a token roster; only a genuinely
token-less legacy deployment falls back to membership-validated request fields.- The value is encrypted and stored immediately as a credential with status
PENDING_APPROVAL. It shows up in the Credentials page (amber Pending approval badge, under Needs attention) and as an item in the inbox, but it is never delivered to any agent while pending. - A human Approves — from the inbox (one click), the crew escalations panel, or
crewship escalation resolve <id> --action approve(no--resolution: aCREDENTIALescalation takes no text) — and the credential flips toACTIVE, attributed to the approver. Only now can the crew use it. - Or Rejects (
--action reject) and the proposed credential is discarded.
/escalate call blocks until the human approves or rejects (up to 5 minutes).
If the agent does not have the value itself, it asks instead — see
Asking a human for a credential.
A free-text ask (no structured metadata) is still accepted: the human names the
credential when supplying it (crewship escalation supply <id> --name PG_PASSWORD).
Provenance is preserved either way: the credential records the agent as proposer or
requester and the human as approver.
When a proposal can’t be staged
The proposed secret is discarded (never persisted in the clear) the moment it is read, so the escalation never reflects success it didn’t achieve:- Name already in use or unknown credential type — recoverable. No credential is
staged, but a plain escalation is still raised with a note explaining why, so a human
can supply or rotate the value manually. The call returns
201. - No workspace owner to approve the proposal, or a vault/encryption error — a hard
failure. No escalation is recorded and the call returns
503with a message the agent can act on (retry, or ask an operator to configure a workspace owner). This avoids a phantom “pending approval” that no one can act on while the secret is already gone.
Segregation of duties (second approver)
By default, any workspace MANAGER+ can resolve aCREDENTIAL escalation below L4 —
including one raised by an agent they created themselves. Regulated workspaces can opt in to
a strict four-eyes rule for every tier: the person who proposes a credential (via their
agent) can never also be the one who approves it.
Enable it per workspace (requires OWNER or ADMIN):
crewship escalation resolve (and the inbox Approve/Reject button) is
refused with a 403 for the user recorded as the owner of the agent that raised the
CREDENTIAL escalation (agents.created_by_user_id — whoever created that agent). This is
checked for every resolution action (approve, reject, redirect), not just approve, and
before any row is mutated. Every blocked attempt is written to the audit journal (a
keeper.decision entry naming the segregation_of_duties rule and the blocked user).
OWNER is not exempt. This is a strict segregation-of-duties gate, not a permission
check — even a workspace OWNER is refused if they are also the recorded owner of the agent
that raised the escalation. Someone else with MANAGER+ role must resolve it instead. The
rule only applies to
CREDENTIAL escalations; TEXT/LINK escalations are unaffected. If
the raising agent has no recorded owner (a legacy agent created before this attribution
existed), the rule fails closed: resolve and supply are refused with a 403 (“a second
approver is required, but the initiating identity is unknown”) rather than waved through,
and the inbox reports the requirement all the same. Such an ask needs an agent with a
recorded owner, or a workspace where neither the toggle nor the tier forces the rule.Scope limit — identity is agent ownership, not the driver. “Initiator” is the agent’s
recorded owner (
created_by_user_id), not necessarily the human who drove the agent to
raise the escalation. If user A owns an agent but user B drives it (via chat) to propose a
credential, the rule blocks A — user B could still self-approve. This covers the common case
(owner drives their own agent); tightening it to the actual requester requires recording the
driving user on the escalation at raise time (planned follow-up).Two guard rails. Enabling the rule on a workspace with fewer than two members who can
approve (OWNER/ADMIN/MANAGER) still succeeds but returns a warning — with only one
eligible approver a credential raised via their agent could never be resolved by someone
else. And
crewship credential rotate (POST /credentials/{id}/rotate) is refused with a
409 for a credential still PENDING_APPROVAL, so rotation can’t be used to activate an
agent-proposed credential outside the four-eyes flow — approve or reject it via its escalation.GET/PUT /api/v1/admin/keeper/governance) — it is a distinct concern (who may approve a
credential escalation, not behavior monitoring) but reuses the same OWNER/ADMIN-gated,
journal-audited settings surface. Default is off.
File-Based Secrets
For non-LLM credentials (database passwords, API tokens), Crewship writes one file per credential to/secrets/{agent-slug}/:
<SLOT>_PATH; GENERIC_SECRET uses <SLOT>; USERPASS uses <SLOT>_USERNAME and <SLOT>_PASSWORD, both containing file paths, never the username/password values. CLI_TOKEN retains its direct token environment variable for tools such as glab. Explicit MCP ${SLOT} references preserve their existing plaintext environment delivery, subject to Keeper and policy. If a GENERIC_SECRET slot is explicitly used that way, <SLOT> remains its literal value and <SLOT>_PATH locates its native file; conflicting names are rejected. This is an intentional second delivery channel, not a promise that the model cannot read the value. The .env file is a diagnostic map: do not source it, because doing so replaces direct token values with paths.
Each run uses $CREWSHIP_SECRETS_DIR (/secrets/<agent>/<run-id>); do not hardcode another run’s path. Duplicate delivery names are rejected before launch. Keeper-gated and unknown types remain withheld according to the credential policy.
Native CLI import
--password-stdin for USERPASS; update also accepts --username. SSH keys and certificates are parsed on writes. Encrypted private keys are not supported by this unattended file delivery; do not provide a passphrase in command arguments. General arbitrary binary import is not established by these text/JSON import paths.
At delivery, only SSH key/certificate text receives CRLF-to-LF conversion and a missing final LF. Existing stored values receive the same normalization without rotating their underlying key. Opaque credentials and named fields remain unchanged. This does not repair corrupt key material or change the remote authorized key.
credential field set --value-stdin preserves the whole UTF-8 input, including
all PEM/JSON lines and the final LF, with the same 64 KiB bound. It rejects NUL,
invalid UTF-8 and simultaneous --value/--value-stdin before contacting the
server. Secret parts remain encrypted and are not returned by field reads.
Delivery audit
Authentication probes use the credential’s type as well as its provider.API_KEY and CLI_TOKEN can use supported vendor probes; Claude setup tokens
retain their dedicated OAuth probe. Files, USERPASS passwords, OAuth2 records
and legacy Codex/Gemini login artifacts are never sent as API keys. A
PROVIDER_LOGIN uses its persisted mode: metered API keys remain probeable,
while subscription logins require their dedicated probe or a real CLI run.
An unknown type is refused. Endpoint checks remain role-gated reachability
checks without authentication material. When no probe ran, Activity records
supported: false without claiming successful authentication.
The required native CLI conformance suite runs actual Claude Code, Codex and
OpenCode shell tools in direct, tmux and fallback modes against isolated SSH,
mutual-TLS, USERPASS basic, bearer-token and GitLab API fixture services. The
Vault-to-CLI regression additionally creates and rotates each fixture through
Crewship CLI, grants/revokes it, resolves it from the encrypted Vault and checks
its bytes and slot before those tools authenticate. A native GITLAB_TOKEN
slot is consumed by standard GITLAB_HOST=gitlab.example.com glab api user;
selecting the target host does not require a stored login or credential wrapper. Test service
configuration is isolated from the operator’s own CLI profiles.
These fixture receipts do not establish authentication against an operator’s
real endpoint, complete qualification of every credential policy type, or a
clean product installer/upgrade. Those scenarios need their own evidence.
A DELIVERED event records a verified native file preflight with credential ID, agent ID and run ID. Activity displays the correlated run and labels delivery and sidecar fetches as authentication unverified; it does not render arbitrary audit metadata. Its metadata identifies the file channel and leaves authentication outcome unknown; it does not update last_used_at. A failed file preflight does not emit delivery, and an audit persistence failure prevents launching the agent. USE/last_used_at remain separate existing signals, including sidecar fetches; they are not proof of a successful remote login. Crew-scoped sidecar fetches cannot truthfully identify one consuming agent or run. Use the standard tool’s exit code and response to verify authentication.
The isolation boundary remains the crew, not individual agents sharing UID 1001. A grant restricts product delivery, but it does not stop another same-UID process in that container from reading a delivered file. Keep mutually untrusted agents or machine-access keys in separate crews. Masking a value in UI/logs does not make an env variable or file inaccessible to its process.
Legacy tmux execution snapshots the fresh container exec environment, including
image PATH/mise settings and the current run’s overrides. It starts the target
CLI from that snapshot rather than inheriting an older tmux server’s credential
variables. Setup material travels over stdin into a new private run directory;
the environment snapshot is unlinked immediately after loading. Completed and
settled failed/cancelled runs remove the directory. This does not erase values
already held by the server or strengthen the crew’s shared-UID trust boundary.
Bootstrap failure cannot report success or leave the output reader waiting for
a producer that never started. An unavailable tmux control channel is UNKNOWN,
not proof that the producer stopped: Crewship retains ownership and HOME until
native stop or container absence can be confirmed. This retention is neither a
successful cleanup nor evidence of authentication.
Lifecycle: in-memory, per-run, removed on completion
/secrets is an in-memory tmpfs mount (16 MiB, mode 0700, owned by the agent UID) — never a host directory. Credential files exist only in RAM inside the running container: they never touch the host disk, never survive a container stop, and can’t leak into host backups or archives. Requires Docker Engine 26+ for the tmpfs ownership options; crew containers created by older Crewship versions (which used a host bind mount) are automatically recreated with the tmpfs on their next use, and the legacy host-side directory is deleted.
The files are also per-run: Crewship rewrites them at the start of every agent run and removes /secrets/{agent-slug}/ again when the run finishes (refcounted, so overlapping runs of the same agent are safe). Between runs there is nothing under /secrets/{agent-slug}/ for another container process to read.
SECRET delivery depends on Keeper
SECRET credentials follow the Keeper state, and the file path mirrors the
env-var path exactly:
- Keeper disabled — the
SECRETis delivered as a0700/0400file under/secrets/{agent-slug}/(and mapped in.env), just likeCLI_TOKENandGENERIC_SECRET. This is the legacy default and is unchanged. - Keeper enabled — the
SECRETis not written to the agent’s filesystem at all, and it is not injected as an environment variable. The agent’s system prompt states it does not have the value in its environment; to use it the agent invokes/usr/local/bin/crewship keeper requestand/usr/local/bin/crewship keeper execute --command-stdin. This fixed runtime path avoids stale or agent-owned binaries earlier inPATH. The CLI uses the original run capability through the local sidecar, with no human profile fallback or manual Authorization headers. Request returns only anALLOW/DENY/ESCALATEdecision; execute runs one command with the secret injected into that command’s environment. The existing Keeper API enforces access control and writes an audit trail without returning the raw value. Withholding happens once, at the config resolver — the plaintext is blanked before it ever leaves the server process, so the env, file, and MCP delivery paths gate on Keeper as defense-in-depth rather than as the sole line. The resolver logs each withheld credential atWARN(env-var name only, never the value), so the gate is observable rather than a silent skip. There is no file to read and nothing under/secrets/{agent-slug}/for a compromised process to scrape.
internal/credpolicy), not by a SECRET-shaped
special case scattered across the delivery paths — so a new credential type is
governed by one row, and an unclassified type fails safe (withheld and not
delivered). Today the gate is SECRET-only: CLI_TOKEN, GENERIC_SECRET,
USERPASS, SSH_KEY, and CERTIFICATE are always delivered as files
regardless of Keeper state — CLI tools and generic secret consumers read them
from disk, and the prompt makes no withhold claim for them.
An unclassified type’s withholding is stricter than SECRET’s: SECRET has an
explicit delivery channel (a file), so with Keeper off it still falls back
to the legacy env-var path. An unclassified type has no delivery channel at
all — it stays withheld regardless of Keeper state, and with Keeper off there
is no /keeper/request path to recover it either, so it is simply
undeliverable rather than gated. If a credential row predates the type enum
(the credentials.type column was unvalidated free text for most of the
product’s life) or names a type that was never given a credpolicy row, it
now goes silently missing from the agent’s environment; the orchestrator logs
a WARN naming the credential’s env-var name and type when this happens, so
the fix is to add the missing row rather than to chase a mysteriously absent
credential.
The sidecar-mode env builder selects a credential for injection through
several independent rules, not one — an OAuth token, a CLI tool’s token, an
adapter-recognized provider API key, and the SECRET legacy fallback are each
matched differently (by type, by value shape, or by env-var name). Every one
of those rules now consults the credpolicy row before it appends a value,
so an unclassified credential cannot reach the env by accidentally matching
one of them (e.g. an env-var name an adapter recognizes, or a value that
happens to look like an OAuth token) — it is withheld the same way regardless
of which rule would otherwise have picked it up.
The non-sidecar env builder (BuildEnvVars() — see Non-Sidecar
Mode below) consults the same
credpolicy row before it writes anything, for the same reason: this path is
not only what runs with the sidecar disabled instance-wide, it is also what a
worker sub-agent uses (SkipSidecar) when the crew’s sidecar is already
running for another agent in the same container. Without this check, an
unclassified credential’s plaintext could be withheld from the lead agent’s
sidecar-built environment and still land in a worker sub-agent’s — the same
credential, the same Keeper state, two different outcomes depending only on
which agent happened to dispatch the exec. BuildEnvVars() gates on the
credpolicy row alone (it has no keeperEnabled parameter and never has):
the fallback row’s DeliveryNone means no channel in either Keeper state,
so no Keeper plumbing is needed to close this gap. This does not change
this path’s pre-existing, unrelated behavior for classified Keeper-gated
types (SECRET) — that legacy env delivery is out of scope here; see
Non-Sidecar Mode.
MCP config references are covered too. The withholding above spans all
three credential-delivery paths — the credential files, the direct env
builder, and MCP env injection. If a
SECRET’s env-var name is referenced by an
MCP server config (e.g. Authorization: Bearer ${DB_PASSWORD}), Crewship does
not inject the value into that MCP process’s environment when Keeper is
enabled: the SECRET is withheld exactly as it is on the file and direct-env
paths, so it stays out of /proc/self/environ and out of the /keeper/* audit
bypass.A consequence follows: because the MCP process runs inside the agent container
and cannot call the Keeper API itself, an MCP server that genuinely needs the
value will not receive it while Keeper is gating that SECRET. If a server must
authenticate with a credential, give it a non-SECRET credential type
(CLI_TOKEN, GENERIC_SECRET, …), or run that server without Keeper-gating the
secret it needs. The gate stays SECRET-only and Keeper-only — non-SECRET
types referenced by MCP configs are injected as before, whether Keeper is on or
off.The trust boundary is the crew, not the agent
Every agent process in a crew container runs as the same principal — UID 1001. The0700 mode on /secrets/{agent-slug}/ protects it from the sidecar (UID 1002), not from sibling agents: to the kernel, all agents in one crew are the same user, so any agent can read and write every sibling’s /secrets/{slug}/ files, home directory (/crew/agents/{slug}/), output, and MCP configs, and can signal every sibling’s processes. The per-run write/remove lifecycle above shrinks the at-rest window, but while two agents run in parallel there is no intra-crew confidentiality.
This is the runtime’s deliberate posture, not an oversight: the enforced isolation boundary is the crew. Each crew gets its own container, its own in-memory /secrets tmpfs, its own home volume, and its own sidecar, and a sibling crew reaches none of those four (the sidecar listens on loopback only). That is resource isolation, not network isolation: every crew shares one Docker bridge, so a crew’s declared service containers are reachable from another crew. Within a crew, agents are assumed to trust each other, the same way processes owned by one Unix user trust each other.
Revoking a file-based secret
Deleting a credential (crewship credential delete <name>, or the UI) removes its /secrets/{agent-slug}/ file(s) from every running crew container that mounted it — immediately, not just on the next boot. The same removal fires when the sidecar reports a credential’s status as REVOKED (e.g. the upstream provider invalidated it). The removal runs server-side, exec’d inside the container as the agent UID (1001): that’s the only principal that can unlink inside the agent’s 0700 secrets directory, so the sidecar (UID 1002) can’t do it and the server does. A successful delete has already cut off live access.
A multi-part credential’s custom field files go with it — the removal covers every file the credential delivered, not just its primary one, so a revoke never leaves a secret access key behind while reporting the credential gone.
It’s best-effort: a stopped container is skipped (nothing to remove; the revoked secret won’t be re-written on the next boot because it’s filtered from every delivery path). The .env map keeps an inert reference to the removed file until the container next boots — harmless, since the file is gone. If you need a guaranteed clean slate, recreate the crew container.
Three Credential Injection Modes
Crewship supports three distinct modes for delivering credentials to agents, depending on the container configuration and credential type.Existing OAuth access tokens for CLI consumers
To deliver an existing OAuth access token to a standard CLI, create anOAUTH2
credential with the environment variable that the consumer expects. Supply the
token on stdin, then grant it to the agent:
GH_TOKEN contains the granted access token and is inherited by
shell tools and child processes. No .env sourcing is needed. This imports an
existing token; it does not start an OAuth authorization flow or configure
refresh by itself. Client secrets, refresh material and MCP-only companions do
not become generic CLI access tokens. Specialized provider login credentials
retain their adapter-specific delivery. An env-delivered token is readable by
the agent process even when its display is masked.
1. Sidecar Proxy Mode (default)
1. Sidecar Proxy Mode (default)
The standard and most secure mode. Credentials are piped to the sidecar process via stdin as JSON at container startup. The sidecar holds them in an in-memory This is a workspace-wide flag, not per-crew: it affects every privileged crew in the workspace and also permits saving privileged container configurations. Enable it only for workloads trusted with host-level authority. A workspace OWNER or ADMIN may turn it off (
CredStore and intercepts outbound HTTP requests, injecting the appropriate authentication headers based on the destination host.- Credentials on a proxy-routed path never appear in environment variables or on disk. Adapters with no routable endpoint,
AI_CLI_TOKEN,OAUTH2and file-delivered types are delivered directly and do — see the adapter matrix - The sidecar runs as UID 1002, inaccessible to the agent (UID 1001)
- Supports priority-based selection and round-robin rotation
--privileged (e.g. Docker-in-Docker) drops no-new-privileges and CapDrop:ALL for the whole container — the same UID 1001/1002 boundary that isolates the sidecar’s memory (and the credentials loaded into it) from the agent no longer holds. A compromised or prompt-injected agent in a privileged container can read the sidecar’s process memory directly.Crewship fails closed by default: the agent-config resolver omits credentials entirely for a privileged crew, and provisioning logs a WARN (#1032) so the trust downgrade is visible in ops. To keep credential injection working for a privileged crew anyway — accepting that the isolation boundary is gone — an instance administrator who is also a workspace OWNER or ADMIN must opt in explicitly. Scoped CLI tokens additionally require both workspace:admin and instance:admin:--allow-privileged-credentials=false) without instance authority. Turning it off does not remove privileges from an existing container; review and recreate privileged runtimes separately.2. Non-Sidecar Mode (legacy)
2. Non-Sidecar Mode (legacy)
When the sidecar is disabled, credentials are injected as environment variables using
BuildEnvVars(). This mode is less secure because credentials are visible in the process environment.This is also the path a worker sub-agent takes when dispatched with SkipSidecar — the crew’s sidecar is already running for another agent in the same container, so the sub-agent’s own exec doesn’t start one and falls back to BuildEnvVars() instead of the sidecar env builder.- API keys are set as
ANTHROPIC_API_KEY,OPENAI_API_KEY, etc. AI_CLI_TOKENcredentials withsk-ant-oatprefix are mapped toCLAUDE_CODE_OAUTH_TOKEN- An unclassified credential type (no
credpolicyrow — the fail-safe fallbackDelivery: DeliveryNone) is withheld here too, in either Keeper state, matching every selector in the sidecar env builder. This keeps the “forgetting to classify a type leaks nothing” promise regardless of which of the two env builders picks a credential up. - Production non-sidecar runs now receive the current Keeper state too.
With Keeper enabled, classified gated credentials (
SECRET) are withheld from the parent and worker environments alike. File-only material uses the same native path aliases on both execution paths.
3. MCP Environment Variable Injection
3. MCP Environment Variable Injection
MCP server configurations in
.mcp.json can reference credentials using ${VAR} syntax in their env blocks. Crewship resolves these references at runtime:- The system scans
.mcp.jsonfor${VAR}patterns in env blocks - Each
${VAR}reference is matched against workspace credentials byenv_var_name - Matched credentials are decrypted and injected as actual environment variables
- Claude Code natively expands
${VAR}references from the container env vars
OAuth Token Handling
Eligible provider-login credentials receive adapter-specific handling. A value’ssk-ant-oat prefix alone cannot turn a file-only or Keeper-gated credential into
a provider login. For an Anthropic subscription login:
- The credential is injected as
CLAUDE_CODE_OAUTH_TOKEN(notANTHROPIC_API_KEY) - OAuth tokens use an HTTPS CONNECT tunnel through the sidecar proxy, not the API key header injection path
- This distinction ensures that Claude Code authenticates via OAuth flow rather than direct API key authentication
The sidecar detects OAuth tokens by their
sk-ant-oat prefix and routes them through the CONNECT tunnel handler instead of the standard reverse proxy path.Credential Health Status
Every LLM credential carries a health status that the dashboard, the CLI (crewship credential list) and the runtime token pool all read:
What sets EXPIRED
- The credential health monitor. It polls each provider’s model-listing
endpoint with the stored credential. A
401maps toEXPIRED, a403toREVOKED. Network failures and5xxmap toERROR, never toEXPIRED— a flaky network must not look like a dead key. - The OAuth refresh worker, when a
OAUTH2-type credential’s refresh grant fails (you also get acredential.expiredworkspace event). - An explicit status update written through
PATCH /api/v1/internal/credentials/{id}. Note this is an internal route: its only caller today is the health monitor itself, so there is no operator or sidecar path that moves a credential back toACTIVE.
What makes a credential recover
EXPIRED is not self-healing, and this is deliberate:
-
API keys (
API_KEY) recover on their own once the provider accepts them again — the next health check gets a200and flips the status back toACTIVE. -
Claude Code CLI / OAuth tokens (
AI_CLI_TOKEN, values startingsk-ant-oat) do not. There is no endpoint that can validate one, so the monitor never probes them — and therefore never asserts they are healthy either. Ansk-ant-oatcredential that has goneEXPIREDstaysEXPIREDuntil you replace the token:
Only
ACTIVE credentials are ever decrypted for a run. An EXPIRED or
REVOKED credential still appears in listings (so you can see and fix it)
but its value is never injected.Monitoring Credential Exposure
Some credentials unavoidably land in the agent’s environment — OAuth tokens and CLI tokens use a CONNECT tunnel / env-var read that the proxy can’t isolate, and SECRET-level credentials are exposed when Keeper is disabled. Whenever a credential does land in the agent env, the Orchestrator logs the exposure so operators can see it and remediate where possible:- WARN (actionable) — a SECRET credential exposed because Keeper is off.
Enable Keeper (
KEEPER_MODEL/KEEPER_OLLAMA_URL) to gate it behind/keeper/requestinstead. - DEBUG (informational) — OAuth/CLI tokens that are structurally un-isolatable. Logged for awareness, not remediation.
crewship agent get <slug>(debug output /service_logs)GET /debug/logs?level=WARN&agent_id=<id>for programmatic access
Master Encryption Key Operations
All credential values are encrypted at rest with AES-256-GCM under a single instance-wide master key (ENCRYPTION_KEY). Two operator concerns follow
from that:
Where does the key live?
On first bootcrewship start auto-generates the key and persists it to
<dataDir>/secrets.env — on default installs the same volume as the
database, so a copied disk carries both the ciphertext and the key. The
server warns about this at startup on every boot, and reports it on the
health surface:
ENCRYPTION_KEY from an external secret store and remove
the entry from secrets.env.
Rotating the master key
crewship admin reencrypt re-encrypts every stored envelope — credential
values, refresh tokens, OAuth client secrets, webhook signing secrets,
Composio keys, PKCE verifiers — to the current key
version. This converts envelopes; it does not retire the v1 root used by
journal and instance-audit MACs:
What’s Next
Keeper Security
Set up AI-powered credential access control with security levels L1-L4.
Encryption Details
Deep dive into AES-256-GCM encryption, byte layout, and key versioning.
Orchestration
Create multi-agent missions with credential failover and CooldownManager.
CLI Reference
Complete CLI reference for credential management commands.
Keeper decision evidence
Vault Activity recordsKEEPER_DECISION separately from delivery, proxy admission
and legacy USE. A verified v2 calling-run identity correlates the decision with
its credential, agent, run and Keeper request. Later human decisions retain that
original identity even after the run ends. Legacy requests without run identity
remain unknown. crewship keeper requests -f json and
crewship keeper history <request-id> -f json expose known run attribution.
These events are policy evidence, not proof of successful authentication.
For access decisions, the live-run check, ALLOW projection, decision ledger,
Vault decision event and optional lease are committed in one database
transaction. For execution requests, live-run admission and an optional lease
with its Vault event share a transaction before secret injection. Failed
admission rolls those writes back and records a system DENY; failed audit
persistence returns an error before authorization escapes. A final live-run
check precedes container execution. Database admission cannot make the later
Docker operation atomic with a run ending, and a delivered or authorized
credential still does not prove successful tool authentication.