The Skin

The skin is the organism's credential, identity, and failure-containment boundary (dna/host/secrets.hl, dna/core/principal.hl, dna/oidc/stub.hl). It…

The skin is the organism’s credential, identity, and failure-containment boundary (dna/host/secrets.hl, dna/core/principal.hl, dna/oidc/stub.hl). It provisions and validates secrets in a local or remote Vault, isolates PostgreSQL and NATS credentials per component, authenticates HTTP callers to the head via OIDC, enforces compile-time secret confinement with std::secret::Credential, and records absorbed runtime invariant failures as violation.recorded rows. Every component fails closed if a required secret is missing, and secret values are never written to committed files, record rows, URLs, CLI arguments, or environment variables.

Terminal window
hale dna secrets # check status of all drawn and user-supplied secrets
hale dna secret set FORGE_TOKEN # populate a secret slot from stdin
hale dna secret rotate FORGE_TOKEN # rotate an existing secret slot from stdin

The Vault

Section titled “The Vault”

Secrets are stored as raw byte entries in a vault, addressed by slot name:

Secret Slots & Drawn Credentials

Section titled “Secret Slots & Drawn Credentials”

Run hale dna secrets to list every secret required by the organism and whether it is present in the vault (secret values are never displayed):

$ hale dna secrets
the organism's secrets (the local vault, …):
present postgres-dna_35bf…_spine memory: the spine's role
present postgres-dna_35bf…_head memory: the head's role
present postgres-owner-35bf… memory: its allocation's superuser in the local habitat
present nats-dna_35bf…-owner the nerves: the owner's account
present nats-dna_35bf…-spine the nerves: the spine's account
present nats-dna_35bf…-head the nerves: the head's account
present nats-dna_35bf…-reflexes the nerves: the reflexes's account
present nats-dna_35bf…-app-refproj the nerves: the application `refproj`'s account
present oidc-client-dna-local the skin: the head's OIDC client secret (the local stub's)
MISSING forge-token the forge's token — a person supplies it: `hale dna secret set FORGE_TOKEN`
present model-HABITAT_35BF… the model map's key for think.deep, think.standard, think.quick (the habitat's models)
1 missing

Every vault entry matches one of the following naming patterns (where <identity> is [dna] record, <org> is dna_<identity>, and <id> is the first 12 hex digits of <identity>):

Vault Slot Name Provisioning Kind Owner / Purpose
postgres-dna_<identity>_spine, …_head Drawn PostgreSQL spine and head database roles
postgres-owner-<id> Drawn Superuser password for the local habitat’s memory-<id> container
nats-<org>-<role> (owner, spine, head, reflexes) Drawn NATS JetStream role accounts
nats-<org>-app-<name> Drawn NATS account for attached application <name>
oidc-client-<client> (dna-local by default) Drawn (loopback issuer) or Slot (remote issuer) OIDC client secret for hale dna head
oidc-service-<service> (per dna.oidc.service) Drawn Machine-to-machine service client secret
forge-token Slot GitHub / forge API token (FORGE_TOKEN)
model-<NAME> (per dna/org/models.hl or dna/org/work.hl) Slot Hosted LLM provider API key (written only when its key was in the vault at graft: no placeholder)
a category’s key_vault (per latest model.category row naming one) Slot The key the model map asks that endpoint with
model-HABITAT_<ID> (<id> upper-cased) Filled by the habitat The organism’s key at the habitat’s models (The Habitat’s Models)
secret-<org>-<name> (per [dna.secrets.<name>] in hale.toml) Drawn or Slot, as declared A secret the seed declares for its own programs and host commands (Declared Secrets)
secret-<org>-<name>--<label> (per member a person fills) Slot (a family) A member of a secret family the seed declares
secret-<org>-<name>--<organism> (per tenant of a models provider) Drawn (a family) A tenant’s key at the habitat’s models: a member of the provider’s key family
hale dna run: the organism's secrets are not all in the vault: … (`hale dna upgrade` draws them; `hale dna secrets` lists them); nothing starts without them

Filling a Slot

Section titled “Filling a Slot”

Populate or rotate a user-supplied slot with hale dna secret set or hale dna secret rotate:

Terminal window
hale dna secret set <NAME> [--body <user@host>]
hale dna secret rotate <NAME> [--body <user@host>]
$ hale dna secret set FORGE_TOKEN
value for FORGE_TOKEN (this machine), on one line:
secret set: FORGE_TOKEN is in its slot of the vault, …/forge-token (secret.rotated FORGE_TOKEN; the value is nowhere in the record). A part reads it from the vault where it uses it

Declared Secrets

Section titled “Declared Secrets”

A seed declares the secrets its own programs and host commands read in its hale.toml, and the habitat keeps each in the organism’s vault and hands it to its readers:

[dna.secrets.operator-token]
kind = "drawn" # the habitat draws it (32 hex), at graft and upgrade
readers = ["api", "host.node"] # programs by directory name; host commands as host.<command>
[dna.secrets.upstream-key]
kind = "slot" # a person fills it: hale dna secret set upstream-key
readers = ["api"]
[dna.secrets.dashboard]
kind = "drawn"
person = "read" # hale dna secret show dashboard reveals it
[dna.secrets.model-token]
kind = "slot"
family = true # several values, each filled under a label
readers = ["worker"]
[dna.secrets.extra-key]
kind = "slot"
optional = true # its readers do without it
readers = ["api"]
services:
api:
environment:
HALE_VAULT_DIR: ${HALE_VAULT_DIR}
HALE_SECRET_OPERATOR_TOKEN: ${HALE_SECRET_OPERATOR_TOKEN}
volumes:
- ${HALE_VAULT_DIR}:${HALE_VAULT_DIR}:ro

A program reads it as std::secret::Credential { vault: std::env::var("HALE_SECRET_OPERATOR_TOKEN") }. Compose’s environment is the project’s, so the grant to the declared readers is the compose file’s to keep; a secret no program reads is never handed.

Automated workflow rotation (secret-rotate@1) is present in the workflow catalog but rejected at admission because workflows are not permitted to write to vault:

secret-rotate@1 a secret rotated
0. rotate vault
1. recorded record
refused at admission: workflow secret-rotate@1 step 0 (rotate) writes the vault (GH #989), which is not built yet

Roles and Accounts

Section titled “Roles and Accounts”

Each DNA component receives credentials only for the specific database role and NATS account it requires:

Component PostgreSQL Role (memory) NATS Account (nerves)
Spine (host supervisor & dna/org) dna_<identity>_spine (read/write record & ledger tables) spine (publish/consume <org>.dna.>, consume heart durable, publish <org>.head.>)
Head (hale dna head, CLI) dna_<identity>_head (read tables, acquire/fence claims, append to ledger) head (subscribe-only; cannot publish)
Migrations (hale habitat migrate) owner DSN (DDL schema migrations; never held by running daemons) owner (create/update/delete JetStream stream)
Application (heart) None app-<name> (publish-only on <org>.app.<name>.>)
Reflexes (dna/reflexes) None reflexes (publish-only on <org>.app.reflexes.>)

PostgreSQL DSNs reference their password via &vault=postgres-<role>, and NATS connections take nats://host:port alongside a std::secret::Credential pointing to the vault slot. See Memory and the Record, The Nerves, and The Heart.

OIDC Authentication for the Head

Section titled “OIDC Authentication for the Head”

Every HTTP session on hale dna head is authenticated against an OpenID Connect (OIDC) provider and mapped to an organizational member name in Git config:

Terminal window
git config dna.principal oidc
git config dna.oidc.issuer https://id.example.com
git config dna.oidc.client dna-head
git config dna.oidc.redirect https://dna.example.com/auth/callback
git config --add dna.oidc.member "<subject>=alice"
git config dna.oidc.board alice
hale dna secret set OIDC_CLIENT_SECRET

Sealed Credentials

Section titled “Sealed Credentials”

In Hale code, credentials are never stored in String fields or variables. Instead, components hold a std::secret::Credential { vault: … }—a @sealed locus that resolves the vault entry on demand and reveals its contents only inside the expression that writes to the network wire.

The compiler enforces that .reveal_text() is consumed immediately in the same statement by a wire write, a whole-value equality check, or a @secret parameter; it cannot be bound to a let variable, stored in a struct/locus field, returned from a function, or branched on (Verification: Secrets).

For example, HostedCredential in dna/core/models.hl reveals a model API key directly inside the outbound HTTP request header:

fn model_key_slot(key: String) -> String { return "model-" + key; }
@sealed locus HostedCredential {
params { key: String = "OPENAI_API_KEY"; scheme: String = "bearer"; }
// the vault's name for it, read where it is presented and nowhere else
fn slot() -> String { return model_key_slot(self.key); }
fn ready() -> Bool { return std::secret::Credential { vault: self.slot() }.ready(); }
// …
@effects(is: { secret_use, external_model })
fn post_json(url: String, body: String, extra: String) -> std::http::ClientResponse fallible(std::http::HttpError) {
let u = std::http::parse_url(url) or raise;
return std::http::request(std::http::ClientRequest {
method: "POST",
url: u,
headers: "Content-Type: application/json\r\n" + extra
+ (if self.scheme == "x-api-key" { "x-api-key: " } else { "Authorization: Bearer " })
+ std::secret::Credential { vault: self.slot() }.reveal_text(),
body: std::bytes::from_string(body)
}) or raise;
}
}

If .ready() returns false (the vault slot is empty), the model router skips that backend before attempting a network connection. Both pond’s NATS client (CONNECT frame) and hale dna head (OIDC token exchange) use the same inline std::secret::Credential pattern.

Closures and Violations

Section titled “Closures and Violations”

When a runtime invariant closure (When Things Fail) fails in a component that cannot recover in place, the owning supervisor absorbs the failure, writes a violation.recorded row ({kind, subject, owner, detail}) to the record, and executes a clean recovery action:

Violation Kind Subject Owner Trigger & Recovery Action
adapter_undeliverable nerves Node holder (user@host:<clone>) A NATS JetStream publish remained unacknowledged past its delivery window. The node stops dna/org and the application, releases the body lease (body.released, why: nerves), and exits 75 so systemd restarts it with a fresh connection.
lease_unsettled Attempt ID spine A worker leg’s attempt lease expired before an outcome was submitted. Logged once per expired lease, after which the attempt is re-dispatched.
pulse_stopped heart Spine holder Pulling from the heart durable consumer failed while the NATS connection remained open. Logged once per outage, after which the host recreates the heart durable and resumes pulling.

Because every request row is persisted to PostgreSQL before NATS delivery, restarting on a violation never loses state: the restarted node re-relays all unanswered requests.

hale dna board displays the total violation count and the 5 most recent violation.recorded rows:

violations: <n> recorded, each absorbed by its owner (the latest last)
<kind> <subject> (<owner>): <detail>

Troubleshooting Common Errors

Section titled “Troubleshooting Common Errors”
Symptom Cause Resolution
… nothing starts without them One or more drawn secrets are missing from the vault Run hale dna upgrade to regenerate missing drawn secrets
secret set: … is no slot of the organism's … The secret name does not match any declared slot Run hale dna secrets to list valid slot names
secret rotate: <NAME> was never set Attempted to rotate an empty slot Use hale dna secret set <NAME> for initial population
no forge token: the vault holds none … The forge-token slot is empty Run hale dna secret set FORGE_TOKEN
hale dna head refuses to start No dna.principal configured, or loopback OIDC issuer lacks pinned dna.oidc.key Configure OIDC settings in git config as shown above (The Head and the Face)