Skip to main content

Workflows secrets overview

Keep credentials out of your workflow YAML. The secrets keyword declares sensitive runtime values per job — Loom resolves provider-backed references at execution time, injects values as file paths by default, and redacts them from all output.

For the conceptual model and security background, see:

YAML shape

Add a secrets block to any job. Each key becomes an environment variable in the job's execution environment.

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

secrets is valid only on job blocks — not in default. This prevents a single declaration from fanning sensitive material to every job in the workflow.

Secret spec fields

FieldRequiredDefaultDescription
refYesProvider URI that identifies the secret value. The URI scheme determines which provider resolves it.
fileNotruetrue: Loom writes the value to a 0600 temp file and sets the env var to the file path. false: the raw value is placed directly in the env var.
requiredNotruetrue: the job fails if the secret cannot be resolved. false: the env var is omitted and the job continues.

Supported URI schemes

SchemeFormatWhen to use
env://env://<VAR_NAME>Value is already in the host environment (CI runner injects it, or exported in the shell). No vault setup required.
keepass://keepass://<database-alias>#<entry-path>:<field>Local or offline encrypted vault. No external service dependency.
op://op://<vault>/<item-path>/<field>Centralized team vaults with access control and audit logging. Resolved via the 1Password Go SDK — no op CLI needed.

All three schemes are implemented and production-ready. Providers fail closed — if auth or config is missing, resolution produces a deterministic SECRETS_* error code rather than a silent fallback.

Choosing a provider

Considerationenv://keepass://op://
Setup effortMinimal — export a variableModerate — create .kdbx, configure alias env varsModerate — create service account, export token
Offline supportYesYesNo (requires network)
Team sharingManual (CI runner config)Manual (distribute .kdbx + credentials)Built-in (vault access control)
Audit trailNoneNone1Password audit log
Best forQuick prototyping, CI-managed secretsSolo/local dev, air-gapped environmentsTeams, production workflows

Use env:// to get started fast. Graduate to keepass:// or op:// when you need structured secret management or team-wide access.

Injection modes

Modefile valueJob seesUse case
File injection (default)truePath to a 0600 temp fileMost cases — lower leakage risk from shell tracing, ps, and interpolation
Direct injectionfalseRaw secret valueOnly when a tool requires a direct env value and cannot read from a file

File-injected secrets are read in scripts with cat:

DB_PASS=$(cat "$DATABASE_PASSWORD")

For Docker jobs, file-injected secrets are bind-mounted read-only into the container. Scripts inside the container use the same cat "$VAR" pattern.

Validation and guardrails

RuleEnforced at
Secret names must match ^[A-Z_][A-Z0-9_]*$loom check (schema validation)
ref must be a non-empty stringloom check (schema validation)
default.secrets is invalidloom check (schema validation)
A key cannot appear in both variables and secrets for the same jobloom check (schema validation)
Malformed or unsupported ref URIRuntime — SECRETS_REF_INVALID
CI_DEBUG_TRACE=true with any file: false secretRuntime — SECRETS_UNSAFE_DEBUG_TRACE

Run loom check before every workflow run to catch schema-level issues early:

loom check

Error codes

CodeMeaningTypical fix
SECRETS_PROVIDER_UNAVAILABLEProvider auth or config is missing or invalidCheck OP_SERVICE_ACCOUNT_TOKEN or LOOM_KEEPASS_DB_* env vars
SECRETS_REF_INVALIDMalformed or unsupported ref URIVerify URI scheme and format against the provider's documentation
SECRETS_REF_NOT_FOUNDProvider cannot find the referenced entry or fieldConfirm the vault/database item exists with loom secrets <provider> item list
SECRETS_REQUIRED_MISSINGA required: true secret could not be resolvedFix the provider config, or set required: false if the secret is optional
SECRETS_UNSAFE_DEBUG_TRACECI_DEBUG_TRACE=true combined with a file: false secretDisable debug trace or switch the secret to file: true

Provider-specific authoring

Each provider has its own URI format, authentication model, and runtime requirements: