Skip to main content
Version: 0.7.x

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.

SyntaxMeaning
${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}"
password: "${secret:KAFKA_PASSWORD}"
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.

  1. An operator submits POST /api/v1/config-approvals, pinning the configuration version, target nodes, and batch size. The submission validates but creates nothing.
  2. A different principal decides. ApproveRollouts is held by admin only; the operator role can submit but not approve.
  3. 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 admin for approval and identity management; day-to-day operators use operator (no ApproveRollouts, no ManageUsers); read-only users use viewer (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/audit enforces ReadAudit and the audit scope.
  • 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, and config_approval.approve.

Verification​

  1. Validate a config with a deliberately missing secret and confirm the error names the path/reference, not a value.
  2. With approval_required on, submit a rollout and confirm a direct create is rejected with approval_required.
  3. Approve as a second principal; confirm the rollout actor is the approver.
  4. Confirm the audit trail shows submission and approval as separate records.
  5. Confirm a revoked managed token gets 401 and 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.