Skip to main content

Workflows secrets overview

Declare secrets on each job using provider references. Loom resolves them before execution and injects temporary file paths by default. Loom replaces exact matches for declared secret values in console/event output, receipt stdout/stderr, output-bearing errors, and provider lifecycle messages. Transformed values and raw declared artifact contents are not covered; inspect and sanitize evidence before sharing it.

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: Loom skips injection and the job continues. An inherited Host variable with the same name can remain.

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 in Alpha 1. Missing or invalid provider authentication or configuration produces a SECRETS_* resolution error. See the support boundary and security limits before adopting them.

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:// for secrets already supplied by your runner, keepass:// for a local encrypted vault, or op:// for a shared 1Password vault.

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: