Skip to content

Runtime identity refresh

A node's runtime credential is short-lived, and the node renews it itself before it expires. When renewal keeps failing, the node narrows what it will do in two steps: first it stops taking new work, then it stops executing. This page is the renewal rule, the proof carried on every request, and the three states that decide whether a node claims and executes.

Refresh

flowchart LR
  subgraph XD["XRATUD"]
    direction TB
    CL["Control-plane client<br/>holds the credential"]
    RS[("Runtime identity state<br/>healthy, degraded, quarantined")]
    IN["Intake<br/>claims new work"]
    WK["Worker phase<br/>executes"]
    CL -->|"fresh or renewed"| RS
    RS -->|"claims_allowed"| IN
    RS -->|"execution_allowed"| WK
  end
  subgraph CP["CONTROL PLANE"]
    direction TB
    RN["Runtime identity issuer<br/>renew"]
  end
  CL -->|"renew inside the window"| RN
  RN -->|"new credential"| CL

The credential lives in the client, and the state it produces lives in the node's runtime state. Intake and the worker phase each read one flag from that state, which is why a node with a failing renewal first goes quiet on new work and then stops executing.

The credential

The runtime credential is a bearer token issued by the control plane at enrollment and on each renewal. Its claims name the process it was issued to:

dataplane_uuid              the logical data plane
dataplane_instance_uuid     the process instance
jti                         this credential's id
aud, exp, nbf               audience and validity window
issuer_revision             the issuer revision that minted it

It also carries the control plane's identity, the tenancy policy revision and the node's tenant_scope and dataplane_pool, which the control plane checks at registration, heartbeat, pull, watch and every assignment report. See Runtime identity issuer.

When the node renews

The node checks freshness once per cycle during preparation, and again before every watch. The credential is fresh until its renewal window opens:

renew_at = exp - max(60, lifetime x (1 - 0.5))

With the default 900 second lifetime the window opens 450 seconds before expiry. Inside the window the node posts to the renewal endpoint with its dataplane_uuid, dataplane_instance_uuid and a requested lifetime between 300 and 7200 seconds, and replaces the credential it holds with the one returned.

A credential already past exp is refused locally, with runtime identity token already expired, and cannot renew itself.

Every request proves possession

A request carries the bearer credential and six headers that bind it to that one request:

x-runtime-pop-method        the HTTP method
x-runtime-pop-path          the request path
x-runtime-pop-body-digest   sha256 of the body
x-runtime-pop-timestamp     seconds since the epoch
x-runtime-pop-nonce         a fresh random value
x-runtime-pop-signature     HMAC-SHA256 over the five values and the credential's jti

The signature covers the body and the path, so a captured request replayed with either changed fails verification. Each nonce is accepted once inside a 900 second window per credential, and timestamps are accepted within 60 seconds of the control plane's clock.

The control plane answers a failed check with one of these reasons:

Reason Condition
RUNTIME_IDENTITY_CREDENTIAL_INVALID The credential does not validate or is not valid yet, answered 401
RUNTIME_IDENTITY_CREDENTIAL_EXPIRED The credential is past exp
RUNTIME_IDENTITY_CREDENTIAL_CONTEXT_MISMATCH A claim disagrees with the request: dataplane_uuid, dataplane_instance_uuid, the tenancy policy revision or digest, tenant_scope or dataplane_pool, answered 403
RUNTIME_IDENTITY_REVOKED The runtime identity has been revoked
RUNTIME_IDENTITY_POP_VERIFICATION_FAILED The signature does not verify
RUNTIME_POP_TAMPER_DETECTED The signed method, path or body digest differs from the request
RUNTIME_POP_NONCE_REPLAYED The nonce was already used inside the window
RUNTIME_POP_CLOCK_SKEW_INVALID The timestamp is outside the allowed skew

On the node, a renewal that fails for any reason is recorded as RUNTIME_IDENTITY_REFRESH_RENEWAL_FAILED with the control plane's answer in the message.

Three states

stateDiagram-v2
  [*] --> healthy
  healthy --> degraded_revocation_freshness_unknown: no fresh check for 900 s
  degraded_revocation_freshness_unknown --> quarantined: a further 300 s
  degraded_revocation_freshness_unknown --> healthy: fresh or renewed
  quarantined --> healthy: fresh or renewed
State Claims new work Executes held work Reason recorded
healthy Yes Yes RUNTIME_IDENTITY_FRESHNESS_VALIDATED
degraded_revocation_freshness_unknown No Yes RUNTIME_IDENTITY_FRESHNESS_STALE
quarantined No No RUNTIME_IDENTITY_FRESHNESS_GRACE_EXCEEDED

The clock runs from the last successful freshness check, so a node that renews at any point returns to healthy in that cycle. The intermediate state exists because the node cannot tell whether it has been revoked while it cannot reach the issuer: work it already holds continues, and new work waits until the question is answered.

Every transition is logged once with the new state and its evidence, under the message runtime identity state transition, and the reason is carried into the worker phase as the reason execution is blocked. A quiet node whose worker phase reports a blocked reason beginning RUNTIME_IDENTITY_ is in one of the two lower states.