Credential providers
Build a factoryOpen a refreshable credential endpoint for a scope or a leaf — the declaration, the manifest, and the exchange protocol.
A long step may outlive the token it started with. A credential provider lets the platform open an opaque endpoint for a scope or a leaf firing: the step's code exchanges that URL for a fresh value while its owner runs, and the URL stops working when the owner closes.
A provider is not a value and not a lease. The platform never hands the resolved token to the step; it hands the endpoint, which is the capability.
type Endpoint = { url: secret }
provider github(repo: text, scope: GithubScope) -> Endpoint
unit triage:
in: { repo: text }
with gh: github(repo: inputs.repo, scope: { "issues": "write" })
step work:
runner: agent
in: { repo: inputs.repo }
out: { done: bool }
The with name binds the endpoint record directly — gh.url is the secret URL
— and there is no acquired/unavailable branch. A provider that cannot open
is a deployment error: the scope or firing fails, it does not park and it does
not silently skip.
Where a provider may open
A with may name a lease or a provider, zero or more times, on a unit,
loop or inline composite, and also on a leaf step.
- A provider opened for a unit is shared by its body and survives a retry of a body step.
- A provider opened for a leaf belongs to that firing; a new attempt opens a new endpoint.
Arguments are evaluated in the scope that opens the provider: a unit sees its
in: values, a leaf sees the enclosing scope (it opens before the firing's own
bindings are resolved).
The manifest
Every leaf receives the endpoints of its whole scope chain as a secret JSON
manifest, keyed by the with name. Inner scopes win.
{
"triage": { "url": "https://factory.example.com/p/<opaque>", "kind": "github" }
}
A local process, a sandbox and an agent read it from FCT_PROVIDERS; a
container receives it as context.providers in its envelope. Read it, keep the
URL out of logs, and call the endpoint the provider names.
The helper
Every deployment serves the helper itself, so a customer's machine never needs access to this repository:
curl -fsSL https://<your-deployment>/install/fct-credentials \
-o /usr/local/bin/fct-credentials && chmod 0755 /usr/local/bin/fct-credentials
The route is public and contains no secret. A self-hosted deployment serves its own copy; the helper is the same file for every instance.
It reads FCT_PROVIDERS (or --manifest <file>, - for stdin, or a container
envelope) and speaks the protocol for you:
fct-credentials get github --write .github-token # mode 0600
fct-credentials check github # windows, not the value
fct-credentials exec github --env GH_TOKEN -- gh pr list
git config credential.helper "!fct-credentials git github"
fct-credentials watch github --write .github-token & # refresh at refresh_at
get prints a string verbatim and a record as JSON; --json/--pretty change
the machine or human form. exec runs the command with the value in the named
variable (a record as JSON). git answers git's credential protocol (username
plus token). watch rewrites the file at refresh_at, retries transient
failures, and stops when the endpoint closes (403/404). The URL is never
printed, and the file mode defaults to 0600.
An AWS session is a record, so --format translates it:
eval "$(fct-credentials get aws --format aws-env)" # AWS_* exports
fct-credentials exec aws --format aws -- aws s3 ls # one command
fct-credentials get aws --format aws-ini --profile prod \
--write /tmp/aws-credentials # shared-credentials file
AWS_SHARED_CREDENTIALS_FILE=/tmp/aws-credentials aws s3 ls
fct-credentials watch aws --format aws-ini \
--write /tmp/aws-credentials & # refresh the file
aws-env/aws-ini need access_key_id and secret_access_key (and write the
session token when present); any other record is an error, and git still
requires a string value. The aws format on exec sets the three standard
variables instead of a single FCT_CREDENTIAL.
Automatic invocation
setup writes the native hooks once, so the tools call the endpoint
themselves:
fct-credentials setup --git github --gh github --aws aws
- git — sets
credential.helperto!fct-credentials git github, so a clone, fetch or push invokes the helper (it reads the manifest from the environment). - gh — writes
~/.local/bin/gh, a wrapper that refreshesGH_TOKENfrom the endpoint and then execs the realgh. Ensure that directory precedes the real binary inPATH;--bin-dirchanges it. - aws — writes
credential_processinto~/.aws/config(thedefaultprofile, or--profile NAME), so every AWS CLI/SDK call asks the endpoint for the session. A non-default profile prints theAWS_PROFILEexport.
Outside a Run (no FCT_PROVIDERS) the git and gh hooks fall through to their
normal login. An AWS credential_process is the profile's credential source,
so on a machine that also needs normal AWS access use --profile factory
(and export AWS_PROFILE=factory inside the Run) instead of overwriting the
default. A disposable step machine usually writes the default. --force
replaces an existing gh wrapper or AWS credential_process; --helper pins
the helper path. The same operations are available by hand with the formats
above.
Exchange
curl -X POST "$URL"
The body is empty and there is no Authorization header — the URL is the
credential. The response carries the value and its windows:
{
"value": "ghs_…",
"expires_at": "2026-12-06T14:02:00Z",
"refresh_at": "2026-12-06T13:32:00Z"
}
Call again after refresh_at. The deployment serves the cached value until
then and resolves a new one afterwards; the reference providers use a 30-minute
window, capped at half the value's lifetime when it is shorter. value is a
string for a secret and a record for a multi-field credential such as
AwsCredentials.
An unknown or closed endpoint answers the same 404 (one shape, so it is not
an oracle). A failed upstream resolution is 409, a method other than POST
is 405, and an over-rate caller gets 429.
Closing a provider marks the grant dead; it does not revoke the token, which expires on its own. The request is frozen when the endpoint opens, so a caller cannot widen the repository, scope, role or key, and the deployment re-applies the Run's provenance and tenant scopes on every exchange.
A provider needs a public origin to serve its endpoint: set FCT_PUBLIC_URL.
Your factories will appear here. Create one and open it beside this guide.