Skip to main content
A secret block declares a named slot for a credential, such as an API token for your policy administration system. It never holds the value. You give the slot a value in Effective after you publish, and only an effect that lists the slot can read it.

Syntax

secret id=policy-admin-token
The id is the slot’s name. The block takes no other attributes. Like other declarations, it can sit anywhere in the document.

Fields

There is no field for the value itself, and none should be added to the source. Never paste a credential into a procedure.

Read a secret in an effect

An effect reads a secret only when its header grants the secrets service and lists the slot:
Inside the effect, read the value with the method that matches the slot’s format:
  • The slot name must be a string literal, written directly in the call. A name built at run time is refused.
  • The slots the effect reads and the slots its secrets= lists must be the same. A listed slot the effect never reads is an error.
  • Every listed slot must have a secret block.
Never return a secret, log it, or put it in data the procedure keeps. An effect that can read a credential can also send it anywhere it can reach, so read secrets only in the effects that need them.

Give a secret a value

  1. Publish the procedure. A draft can’t declare secrets, so try secret-free changes as drafts and publish the source that reads secrets. Publishing records each slot. Reading a version lists them under secrets, each with its name, format and description.
  2. Set a value in Effective. Set it on the procedure’s page in the Effective app, under Secrets. Each slot can have two values:
    • Shared default: one value for the procedure, used by every run that has no override.
    • Personal override: a person’s own value, used for runs that run as that person. It takes precedence over the shared default.
When an effect reads a slot, the run uses the override of the person the run runs as, if they set one, and otherwise the shared default. A run started from the API runs as the API key’s user; a run started by a trigger runs as the trigger’s authorized user. If the slot has no usable value, or the value doesn’t match the slot’s format, that effect call fails. An override that is set but unusable doesn’t fall back to the shared default. Removing a secret block from a later version doesn’t remove the slot: older versions and runs in progress may still need it.

Example

This procedure reads a policy’s status from an illustrative policy administration system at pas.northwind.example, with a bearer token from the policy-admin-token slot.
read-policy-status.procedure.md

On retry and resume

  • The value is read for each call. Each time the effect is called, including each retry, the run looks up the current value. All reads within one call see the same value.
  • Changing a value needs no new version. Set a new shared default or override, and later effect calls use it. The procedure’s source and version don’t change.
  • The value stays out of the record. Effective never writes a secret’s value to the source, the version or the run record. The run records which slot was used, never the value. Code that reads a secret must not return it in a step’s result, because results are recorded.

Common errors

A missing value isn’t a compiler error. It fails the effect call when the run reaches it.

See also