Secrets and approvals
Two controls protect configuration changes: secret references keep credentials out of YAML, and the approval gate keeps a single principal from publishing a fleet-wide change alone. This runbook covers both, plus the audit trail that ties them together.
Secret references
Any string value may embed a reference, resolved once when the configuration is
materialized (--config, --validate, or a control-plane apply). The stored
configuration keeps the reference text; only the running process holds the
resolved value.
| Syntax | Meaning |
|---|---|
${env:VAR} | Environment variable VAR; error if unset. |
${env:VAR:-default} | VAR, or default when unset or empty (${env:VAR:-} allows an explicit empty value). |
${file:/path} | File content with trailing newlines stripped (a mounted Kubernetes secret). |
${secret:NAME} | Environment variable ARKFLOW_SECRET_<NAME> — a dedicated credential namespace; supports :- defaults. In Hub-dispatched deployments the Hub pre-resolves these at rollout dispatch, so Agents never need the secret environment. |
$${ | Escape for a literal ${. |
Rules:
- References work anywhere inside a string, including nested maps and arrays.
- Resolved values are not rescanned; a secret containing
${...}stays literal. - Errors name the configuration path and the reference, never the value.
- Unknown schemes stay verbatim (forward compatibility).
- Resolution is strict: a missing variable fails validation/startup rather than silently becoming empty.
Example (fragment):
output:
type: kafka
brokers: ["broker:9092"]
topic: {type: value, value: orders}
security:
protocol: sasl_ssl
sasl:
mechanism: scram-sha-512
username: "${secret:KAFKA_USER:-arkflow}"
password: "${secret:KAFKA_PASSWORD:-change-me}"
tls:
ca: /etc/arkflow/certs/ca.crt
In a Hub–Agent deployment, validate/apply a configuration where its references
resolve. A config referencing a node-local secret must be applied where that
secret exists; the ${secret:} namespace avoids exposing it to every Agent.
Approval gate
Set control_api.approval_required: true (with approval_ttl_ms, default 24h)
to require a second principal before any configuration rollout is created. Every
creation path is gated: the batch creation route, node-level apply, and
rollback.
- An operator submits
POST /api/v1/config-approvals, pinning the configuration version, target nodes, and batch size. The submission validates but creates nothing. - A different principal decides.
ApproveRolloutsis held byadminonly; the operator role can submit but not approve. - Approval creates the rollout with the approver recorded as the actor. A crash between creation and marking is recovered by adoption — at most one rollout exists per request.
Operational requirements:
- Two identities. A single static operator credential resolves to one principal and cannot approve its own submission; enabling the gate on a one-identity deployment freezes publishing (the Hub logs a warning).
- Pre-applied rollback. Rollback is exempt only when the target version was previously applied to the affected nodes. Rolling back to a never-applied version is new content and is rejected.
- Terminal decisions. Rejected and expired requests are terminal; submit a new request to republish.
Least privilege and audit
- Use
adminfor approval and identity management; day-to-day operators useoperator(noApproveRollouts, noManageUsers); read-only users useviewer(read +ReadAudit). - Grant resource scopes so a credential acts only on its nodes/jobs/audit records.
- Rotate managed credentials and revoke tokens on offboarding. Node credentials
(
arkn_…) are per-node and revocable; rotate on suspicion. - Audit events are actor-attributed and contain scalar metadata only, never
secret material.
GET /api/v1/auditenforcesReadAuditand theauditscope. - The Hub does not defend against a malicious admin creating a second local
identity to self-approve; detect that through external review and alerting on
user.create,credential.create,config_approval.submit, andconfig_approval.approve.
Verification
- Validate a config with a deliberately missing secret and confirm the error names the path/reference, not a value.
- With
approval_requiredon, submit a rollout and confirm a direct create is rejected withapproval_required. - Approve as a second principal; confirm the rollout actor is the approver.
- Confirm the audit trail shows submission and approval as separate records.
- Confirm a revoked managed token gets
401and is not retried as a JWT.
Rollback
- Approval: reject or let the request expire; nothing is created. An already approved rollout is rolled back through the normal configuration rollback path (only to a previously applied version).
- Secret rotation: update the referenced secret and re-apply; keep the previous value available until the rollout converges. A failed resolution blocks the apply, not the running configuration.