Skip to main content

Secrets overview

Loom secrets let you pass sensitive values — passwords, tokens, private keys — into jobs at runtime. Workflows store only references, and Loom resolves those references just before execution, keeping secret bytes out of YAML, compiled artifacts, receipts, and logs.

New to secrets? Start with the Secrets concept page for the mental model, then return here for configuration detail.

Declaring a secret

Each secret maps an environment variable name to a provider reference on a job block:

deploy:
stage: ci
target: linux
secrets:
DATABASE_PASSWORD:
ref: keepass://local/main#services/loom/deploy:password
file: true
API_TOKEN:
ref: op://Engineering/services/loom/deploy/token
file: false
required: false
script:
- ./scripts/deploy.sh

Spec fields

FieldRequiredDefaultDescription
refYesProvider URI. Scheme determines which provider resolves the value (env://, keepass://, op://).
fileNotrueWhen true, Loom writes the value to a 0600 temp file and sets the env var to the file path. When false, the raw value is placed directly in the env var.
requiredNotrueWhen true, the job fails if the secret cannot be resolved. When false, the env var is omitted and the job continues.

Scoping rules

  • Secrets are job-scoped only. default.secrets is invalid and rejected by the schema validator.
  • A key cannot appear in both variables and secrets on the same job — the validator rejects the overlap.

Injection modes

Modefile valueJob seesWhen to use
File injection (default)truePath to a 0600 temp file containing the secretMost cases — reduces leakage from shell tracing, ps, and interpolation
Direct injectionfalseRaw secret value in the environment variableOnly when a tool requires a direct env value and cannot read from a file

For Docker jobs, file-injected secrets are bind-mounted read-only into the container and rewritten to container-local paths. Scripts inside the container use the same cat "$VAR_NAME" pattern.

Reading a file-injected secret in a script

# file: true (default) — the variable holds a file path
DB_PASS=$(cat "$DATABASE_PASSWORD")
curl -u "admin:${DB_PASS}" https://db.example.com/health

Using a direct-injected secret

# file: false — the variable holds the raw value
echo "machine api.example.com password ${API_TOKEN}" >> ~/.netrc

Supported providers

ProviderURI schemeAuth requirementDocumentation
Environment passthroughenv://<VAR_NAME>None (reads host env)Providers index
KeePasskeepass://<alias>/<db>#<path>:<field>Alias-based runtime configKeePass provider
1Passwordop://<vault>/<item>/<field>OP_SERVICE_ACCOUNT_TOKEN1Password provider

All providers follow the same contract: resolve only declared job secrets, return values to the in-memory injection flow, and fail closed on missing or invalid credentials.

Redaction

Resolved secret values are automatically redacted before Loom writes to any output boundary — console streams, receipt stdout/stderr, error fields, and provider lifecycle messages. Redacted output uses stable tokens:

[REDACTED:SECRET_DATABASE_PASSWORD]

Redaction is a defense-in-depth measure. Avoid printing secret-bearing variables in scripts even though redaction is active.

Error codes

When secret resolution fails, Loom reports a deterministic error code:

CodeCauseResolution
SECRETS_PROVIDER_UNAVAILABLEProvider backend, config, or auth is unavailableCheck provider auth setup — see the relevant provider docs
SECRETS_REF_INVALIDMalformed or unsupported ref URIVerify URI scheme and format against the provider's URI anatomy
SECRETS_REF_NOT_FOUNDTarget entry, item, or field does not exist in the providerCheck vault/database contents and confirm the path is correct
SECRETS_REQUIRED_MISSINGA required: true secret could not be resolvedEither fix the provider config or set required: false if the secret is optional
SECRETS_UNSAFE_DEBUG_TRACECI_DEBUG_TRACE=true combined with a file: false secretRemove debug trace or switch the secret to file: true

Security guardrails

Loom enforces several invariants to prevent accidental credential exposure:

  • Workflow YAML stores references only — never credential material.
  • Vault credentials (master passwords, keyfiles, service account tokens) must be supplied through runtime environment configuration, not workflow files.
  • CI_DEBUG_TRACE=true with any file: false secret triggers a hard failure before execution.

For the full threat model, controls, and incident response procedures, see Secrets security.