Operations Guide
Running acdp-registry in production. See CONFIGURATION.md
for the full config reference and AUTHENTICATION.md for the
auth/federation model.
Deploying with Docker
cd docker
docker compose up -d --buildThe compose file boots Postgres + the registry server. Configuration is read
from docker/config.docker.toml (mounted read-only); the Postgres URL comes
from ACDP_REGISTRY_STORAGE__POSTGRES_URL. The image is built with the
storage-pg feature (STORAGE_FEATURE build arg), and acdp is pulled from
crates.io, so the build context is just this repo.
Secrets are sourced from the environment or a sibling .env file via
${VAR:-default} substitution. The compose file ships no default for the JWT
secret: ACDP_REGISTRY_AUTH__JWT_SECRET resolves to empty unless you set
ACDP_REGISTRY_JWT_SECRET, and that is what lets the quickstart boot as
documented. It previously defaulted to the literal changeme, which did not
boot at all — the stack this section described was never startable.
The startup validator rejects that literal (case-insensitively, after trimming)
whenever jwt_secret is non-empty and jwt_signing_alg is not EdDSA —
including with auth.enabled = false, which is the shipped compose posture. The
refusal happens before store.migrate(), so a rejected config creates no
database files. The two checks are gated differently, and the asymmetry is
deliberate rather than an oversight:
| check | gated on auth.enabled? |
|---|---|
a non-empty jwt_secret that is changeme, or is not base64 of ≥32 bytes | no — always runs, for any non-EdDSA algorithm |
an empty jwt_secret (refused unless auth.allow_ephemeral_secret) | yes — empty + auth off is a supported configuration, and is how the quickstart runs |
Under EdDSA the secret is not examined at all; the key comes from
jwt_private_key_pem. Set a real secret before enabling auth or promoting
beyond a disposable demo:
echo "ACDP_REGISTRY_JWT_SECRET=$(openssl rand -base64 32)" >> docker/.envFor multi-host deployments, put acdp-registry behind a TLS-terminating proxy
(Caddy, Nginx, ALB). See RAILWAY.md for a Railway recipe.
TLS
The [registry.tls] block can serve HTTPS directly via rustls, but the
recommended topology is to terminate TLS upstream and let the registry serve
plain HTTP behind it — cert rotation without restarts, standard ops. The example
port = 8443 is a hint that HTTPS is expected at the edge; the binary serves
plain HTTP on any port.
Inbound TLS was broken before 0.1.4, and the smoke tests could not see it
Setting registry.tls.enabled = true used to abort the process at startup with
exit code 101: the dependency graph enables two rustls crypto providers
(aws-lc-rs via axum-server's tls-rustls, ring via reqwest's
rustls-tls), neither of them selected by a feature this workspace controls,
and nothing installed one explicitly. rustls refuses to guess.
The symptom was worse than a failed start. main logs listening with the bind
address before entering the TLS branch, so an operator saw a normal
startup line and then a dead process with the port refusing connections. If you
ever saw that and concluded the config was wrong, it was not — tls.enabled was
simply unusable.
Fixed by installing ring explicitly, before the listening log.
Why no test caught it, which is the part worth keeping.
docker/config.docker.toml sets tls.enabled = false, so the container smoke
tests exercise the plaintext path only and would not have caught this — nor will
they catch a regression. Nor could an ordinary in-process test: the failure was
in the shipped binary's dependency set, not in library code a test links
against, so a test build could import a crypto provider the real binary did not
have. The guard is crates/acdp-registry-server/tests/tls_startup.rs, which
spawns the real binary and requires it to serve HTTPS — its red state was
measured on the unfixed tree (exit 101) before the test was written.
Note the asymmetry: cross-registry resolution and webhook delivery are
outbound and require HTTPS (the acdp SsrfPolicy refuses HTTP and
private/internal authorities). That's independent of how you serve inbound
traffic.
Binding a public interface
A non-loopback bind (e.g. 0.0.0.0) with neither TLS nor auth enabled fails
startup unless you set registry.allow_public_bind = true. This is a guardrail
against accidentally exposing an unauthenticated registry — prefer enabling auth
or fronting with a proxy over flipping the flag.
Tenancy adds its own startup refusals, and a warning for any_peer on a public
bind; they are listed in MULTI-TENANCY.md
and its strict-mode section.
Configuration precedence
defaults < TOML file < ACDP_REGISTRY_* env varsACDP_REGISTRY_<SECTION>__<FIELD> uses a single underscore after the prefix and
double underscores between nesting levels:
export ACDP_REGISTRY_STORAGE__POSTGRES_URL="postgres://acdp:acdp@db:5432/acdp"
export ACDP_REGISTRY_AUTH__JWT_SECRET="$(openssl rand -base64 32)"
export ACDP_REGISTRY_WEBHOOK__URL="https://example.com/hooks/acdp"
export ACDP_REGISTRY_WEBHOOK__SECRET="$(openssl rand -base64 32)"
export ACDP_REGISTRY_WEBHOOK__ENABLED="true"Migrations
Migrations run automatically at startup and are idempotent — restarting an
already-migrated database is a no-op. To add one, drop a new sequential SQL file
into crates/acdp-registry-<backend>/migrations/ and let CI cover the upgrade
path. Never edit an applied migration.
Rolling back a release (Postgres). The Postgres migrator tolerates a
database that is ahead of the running binary — it can roll back one release
without crash-looping, because migrations are required to stay additive (see
CONTRIBUTING.md). That tolerance shipped in 0.2.0, so it only helps when the
binary you roll back to is 0.2.0 or later. 0.1.5 and earlier refuse to
start against a database carrying a migration they do not know; rolling back
to one of them needs the manual step in
UPGRADING.md · 0.2.0 first. Applied migrations remain
checksum-verified, so a corrupted or edited migration still fails startup. The
orphaned table/columns from the newer migration are left in place and simply
unused by the older binary; to fully retire a migration, delete its row from
_sqlx_migrations and drop its objects by hand. The SQLite migrator has no
such tolerance: a SQLite database migrated by a newer release does not start
under an older one.
Migration 021: change feed bucket hashes
Migration 021_changes_bucket_hashes adds lineage_hash and agent_hash to
the changes table (RFC-ACDP-0018 §6.1 bucket filters), fills them for every
existing row, and indexes them. It runs at startup on every deployment, with
[changes] on or off, because the feed is written whenever a [receipt] key
is configured.
Postgres. The migration runs in one transaction and holds ACCESS EXCLUSIVE on changes from its first ALTER through the backfill UPDATE,
SET NOT NULL, two CHECKs and two index builds, until it commits. While it
holds that lock, GET /changes, the hint worker, the prune task, lifecycle
events and superseding or key-revocation publishes wait, on old and new
replicas alike. Plain first publishes do not touch changes and carry on.
- Size the hold before deploying. Run
SELECT count(*) FROM changes;and divide by the backfill rate: about 28,000 rows/s measured on PostgreSQL 16 (27,500 to 35,400 over four runs of 100,000 rows with receipt-sized JSONB, backfill and both index builds included; use 25,000 for planning). The feed is bounded byretention_seconds, so the count is the last 30 days of lifecycle events, supersessions and revocations. - Compare it with the platform's startup health-check grace. Migrations run before the listener binds. If the platform kills the new replica mid-migration, the transaction rolls back cleanly and the old replicas keep serving, but the deploy loops. If the estimate exceeds half the grace, raise the grace for this deploy or pick a quiet window.
- Acquiring the lock is bounded. The migration sets
lock_timeout = '5s'for its own transaction. If a long read holdschanges, it gives up withcanceling statement due to lock timeout(SQLSTATE55P03), the new replica fails startup, and the old replicas keep serving. Retry the deploy. Without the timeout, the waitingALTERwould queue every later reader and writer behind it. - N-1 safe. An insert trigger fills the hashes when a binary does not
supply them, so an older binary running during a rolling deploy, or after a
rollback, still writes correct rows, and the columns can be
NOT NULL. A rollback leaves the columns, indexes and trigger in place, harmlessly. - Abandoning the feature entirely (never needed for a rollback):
DROP TRIGGER changes_fill_bucket_hashes ON changes; DROP FUNCTION changes_fill_bucket_hashes(); DROP INDEX idx_changes_lineage_hash, idx_changes_agent_hash; ALTER TABLE changes DROP COLUMN lineage_hash, DROP COLUMN agent_hash;, thenDELETE FROM _sqlx_migrations WHERE version = 21;.
SQLite. SQLite has no SHA-256 function, so the SQL adds nullable columns,
the indexes and two triggers that refuse a row without both hashes or an
update that clears one; migrate() then backfills existing rows in Rust, in
batches of 1000 under BEGIN IMMEDIATE, and refuses to start if any row is
left without hashes. A crash mid-backfill is safe: the next start resumes.
As with every SQLite migration, there is no N-1 tolerance: rolling back past
021 means restoring the pre-upgrade backup, and a restore is a sequence reset,
so follow the restore runbook in full, including raising
[changes] cursor_epoch before serving again. Row-anchor detection covers
only the cursors whose anchor row was overwritten; the epoch covers the rest.
Admin endpoints
All six are bearer-gated against auth.admin_tokens (constant-time compare;
an empty list disables every route that checks it). See
HTTP-API.md for the full picture. Generate admin tokens
out of band and distribute them to operators / monitoring.
-
GET /admin/status— always shipped, admin-bearer gated. An operational snapshot: build identity, storage health, idempotency record count, webhook queue depth, configured revocation feeds, migration state, and the tenancy policy in effect (tenancy.tenant_header_trustis the effectiveX-Tenant-Idtrust mode, #391). Good for a readiness probe richer than/healthz. Shape in HTTP-API.md.The
buildgroup answers "exactly which binary is running":version(the same string/healthzserves unauthenticated),commit, andstorage_impl.commitis omitted when the binary was not built bydocker.yml— that absence is the signal that the build is not uniquely identified, becauseversionthen degrades to the bare package version that every locally built binary shares. When diagnosing "which build is in this pod", an absentcommitmeans you cannot answer that from the service and must fall back to the image digest.storage_implis an opaque diagnostic string (a Rust type path) — display it, do not parse it. -
GET /admin/contexts,POST /admin/pinned-keys/reload— only in builds with theplaygroundCargo feature. Both are admin-bearer gated.GET /admin/contextsauthenticates the caller but names no agent DID, andadmin_listunconditionally passestruefor the store'spublic_arm_openparameter — the local is spelledadmin_sees_public_armwhere it is declared inadmin_list(crates/acdp-registry-core/src/handlers/admin.rs) and is passed as the fifth positional argument, binding toExtendedRegistryStore::list_contexts'spublic_arm_openparameter (crates/acdp-registry-store/src/lib.rs), so it reaches the RFC-ACDP-0008 §4.5 public arm only — restricted and private contexts are never disclosed to it. (The configuredauth.anonymous_public_readsis not consulted on this path: it scopes only unauthenticated requests, and an admin bearer is authenticated.)
curl -H "Authorization: Bearer $ADMIN_TOKEN" https://registry.example.com/admin/statusJWKS and key distribution
With auth.jwt_signing_alg = "EdDSA", the registry's Ed25519 public key is
published at GET /.well-known/jwks.json so federated peers verify your tokens
without a shared secret. With the default HS256, that endpoint returns an
empty key set and the symmetric jwt_secret is never exposed. See
AUTHENTICATION.md.
Revocation federation
This registry is a revocation consumer: it polls peers' feeds and mirrors
their revocations locally. Configure peers with [[auth.revocation_feeds]]
(issuer, feed_url, admin_token, poll_seconds). Cursors are durable
(unix-ms) and advance only when an entire page applies cleanly, so a restart or
a mid-page failure replays rather than skips. GET /admin/status reports the
configured feed count. Full behavior:
AUTHENTICATION.md.
Cross-registry federation
With registry.cross_registry_resolution = true, a GET /contexts/{ctx_id} for
a foreign authority is resolved against that registry anonymously (no
caller-credential forwarding), so only remote public contexts are surfaced.
The acdp SsrfPolicy (see acdp-rs · Security Model) rejects
private/internal authorities with 502 cross_registry_resolution_failed. Set
the key to false to return 404 for foreign ids instead.
Rate limiting
Per-agent, per-process, in-memory fixed-window counters:
limits.publish_rate_per_minute on POST /contexts (and, from the same
per-agent bucket, the producer lifecycle routes) and
limits.challenge_rate_per_minute on POST /auth/challenge (both default 60,
0 disables; 429 + Retry-After when drained). The full list of 429
sources is in HTTP-API.md · Rate limits.
On top of these, the FEAT-06 [rate_limit] section adds per-IP and
process-global buckets over the whole /auth/* subrouter (token issuance /
refresh / revoke) — the most attacker-controllable surface. Unlike the
per-agent buckets, these key on the resolved client IP, which an unauthenticated
attacker can't rotate as freely as agent_id. The client IP is the TCP socket
peer unless rate_limit.trusted_proxies marks the peer as a trusted reverse
proxy, in which case it comes from X-Forwarded-For (see
CONFIGURATION.md · [rate_limit] for the
trust model — XFF is never honoured from an untrusted peer). The server is bound
with into_make_service_with_connect_info, so the peer IP is available behind
axum_server.
By default all of these are per-process. Behind a load balancer set
trusted_proxies to the balancer's own addresses (IPv4 gateways in IPv4 form;
entries are matched as written, and a /0 entry is refused at startup) so
per-IP limits track real clients (the same list is the boundary for
auth.tenant_header_trust = "trusted_proxies"); the global_per_minute
ceiling is then per replica. With more than one replica you have three options
for the /auth/* bound:
- Gateway / proxy limits in front of the registry. Required in any case if you need protection against a volumetric flood: every limit the registry enforces runs after the request has already reached the registry process.
[rate_limit] backend = "postgres"— the per-IP and global ceilings are counted once across every replica sharing the database (tablerate_limit_windows, anUNLOGGEDtable). Postgres storage only; see CONFIGURATION.md ·[rate_limit]for the keys and the startup checks. The in-memory limiter stays in front as a pre-filter, so a request it rejects never touches the database and database writes stay bounded by the in-memory limits regardless of attacker volume. If the database cannot answer,backend_unavailable = "allow"(the default) falls back to per-process limiting rather than failing token issuance;"deny"refuses instead. Watchacdp_registry_rate_limit_shared_total{outcome="unavailable"}and theacdp_registry_rate_limit_shared_secondslatency histogram (HTTP-API.md · metrics): the singleauth_globalrow is updated by every/auth/*request fleet-wide, so its latency is the figure to check before raisingglobal_per_minuteinto the tens of thousands across several replicas.- Accept per-replica bounds. Each replica enforces its own limits, so the
effective cluster-wide ceiling is
replicas × global_per_minute.
The Postgres backend is a fairness and abuse bound, not a DDoS defence: do
not rely on it instead of an edge limiter. It is also not needed on a single
replica — every deployment recipe in this repo runs exactly one. Its counters are
ephemeral by design (the table is UNLOGGED): after a database crash or standby
promotion one window's budget resets once.
Read rate limits (RFC-ACDP-0008 §4.3)
[read_limits] (off by default) bounds every data-plane GET/HEAD: per
client address for anonymous reads, per requester DID for authenticated
ones. Keys and defaults are in
CONFIGURATION.md · [read_limits].
Things to know before turning it on:
- Per replica. The read buckets are in memory only; the Postgres backend above does not cover them. With N replicas a client can read up to N × the budget. A read limiter that cost a database round trip on every read would be a worse trade.
- Behind a proxy, trust the forwarded header first. Without
trusted_proxies(orrate_limit.forwarded_header_trust = "any_peer") every anonymous client shares the proxy's address and so one bucket: the first busy client throttles everyone. On a platform whose edge addresses cannot be listed,any_peerreads the rightmostX-Forwarded-Forhop from every peer. Use it only when the registry is reachable solely through that edge. If the edge appends its own address after the client's (Railway does), also setrate_limit.forwarded_skip_rightmostto the number of edge hops, or every limiter keys on the edge instead of the client (CONFIGURATION.md shows how to find the number). Then check two things. First, the key is the client: from one machine, send more anonymous reads in one minute thananonymous_per_minuteallows; the excess must answer429. Second, it cannot be forged: repeat with a different forgedX-Forwarded-Foron every request, then with two forged header lines (X-Forwarded-For: 1.2.3.4andX-Forwarded-For: 5.6.7.8); the excess must still answer429. Spoofing probes alone are not enough: a key on the edge address passes them, and limits nobody. - Watch
acdp_registry_rate_limit_rejections_total{scope="read_anonymous"}and{scope="read_principal"}. A steady rise inread_anonymousfrom many clients usually means the budget is too low for a shared NAT or the proxy trust is missing, not abuse. - The budgets are not advertised in capabilities unless
read_limits.advertiseis set. Keep it off while any consumer is on acdp 0.19 or older: they reject alimitskey they do not know, and with it the whole capabilities document.
Metrics
Set metrics.enabled = true to mount GET /metrics (Prometheus text
exposition). It sits outside the auth pipeline and the rate limiter so a scraper
reaches it unimpeded; gate it with metrics.bearer_token (or network policy)
when the endpoint is reachable from untrusted networks. Beyond HTTP
request-rate/latency/status by route, the registry exports domain counters
(publishes by outcome, receipts minted, log leaves appended, lifecycle events,
witness cosignatures, rate-limit rejections, change-feed requests and prunes,
subscription requests, hint deliveries by outcome, hint backlog age). Full metric list:
HTTP-API.md · GET /metrics.
Event receipt sweep
A registry that mints RFC-ACDP-0017 §10 event receipts ([lifecycle] enabled = true and a
[receipt] key) runs a sweep on every start, after migrations and before it serves a request. It
receipts each stored lifecycle event that has none: events accepted before minting was on, or while
an older binary was running. Each context is filled in its own transaction under the same lock a
lifecycle commit takes, so several replicas starting together fill each event exactly once.
- Log.
event receipt sweep complete (RFC-ACDP-0017 §10.2)withcontexts_filled,receipts_filledandcontexts_skipped, logged only when it did something. A store error fails startup withevent receipt sweep: …. - Skipped contexts have an un-receiptable history: a NULL receipt before a receipted event, or a
corrupt stored receipt (logged at
errorwith thectx_id), or a context or event row this binary cannot decode (event receipt sweep: undecodable context; skipped). Bad data on one context never refuses startup. The sweep never rewrites a stored receipt, so such a context keeps omittingregistry_state.event_receiptsand is skipped again on every start. Each read of it logsevent_receipts incomplete; omitting the memberatwarn. - Startup time. The sweep runs before the listener binds, one short transaction per context, sequentially. Its cost is proportional to the number of contexts with un-receipted events, which on the first start after upgrading is every context with lifecycle events. If that number is large, raise the startup/liveness probe budget for that rollout. Progress is durable, so a killed start resumes where it stopped. Later starts read only the un-receipted rows (a partial index from migration 016) and are effectively free.
- Metrics (with
[metrics] enabled = true; the sweep's counts are recorded too).acdp_registry_event_receipts_minted_total,acdp_registry_event_receipts_sweep_skipped_totalandacdp_registry_event_receipts_incomplete_total(see HTTP-API.md). A rising incomplete count after the sweep has run points at a skipped context. Each replica sweeps on its own start and re-counts the contexts it skips, so…_sweep_skipped_totalgrows with replicas × restarts for the same contexts: alert on the incomplete count, or on the skipped count staying above zero, not on its rate. During a Postgres rolling upgrade, events that 0.5.5 replicas still accept have no receipt until the next append or restart, so the incomplete count rises then too.
Change hints
With [events] enabled each replica runs a hint worker. It wakes after
every commit that can grow the change feed and every 15 seconds for
retries, claims due subscriptions with a 60-second lease (Postgres:
FOR UPDATE SKIP LOCKED, so replicas split the work rather than duplicate
it), evaluates each one exactly as the owner's GET /changes, and POSTs
one signed hint covering every new visible change.
On SIGTERM the worker stops claiming, finishes the batch in flight (the
process waits up to the 60-second lease for it, so give the container a
stop grace of at least 60 s, or accept that a kill inside it is the
crash case below) and exits. A replica that
dies mid-delivery leaves only a lease, which lapses; another replica (or
the restarted one) tries again, so a receiver can, rarely, see a hint
twice. Hints are idempotent by design: the receiver reads the feed
from its own cursor.
What to watch:
acdp_registry_hint_deliveries_total{outcome="failed"}or{outcome="ssrf_refused"}rising: a receiver is down, or its host now resolves somewhere private, no longer resolves, or its nameserver does not answer within 5 seconds (allssrf_refused; the warn log says which). The subscription retries with backoff (one minute doubling to hourly) and disables itself after 72 hours of failure.acdp_registry_hint_oldest_due_secondsclimbing: a subscription owed a hint has been due that long without one being recorded — the worker is behind (every replica's batch is full) or deliveries keep failing; a receiver in backoff counts from its retry time, not from the change.acdp_registry_hint_subscriptions{status="disabled"}above zero: disabled subscriptions are kept, still count toward their owner'smax_subscriptions_per_requester, and are never retried. The owner deletes and re-creates one to resume; there is no operator re-enable.{outcome="unknown_key"}after a[changes]key rotation (or on one replica with the wrongkey_id): subscriptions sealed under the old key are retried, and disabled once they have failed for 72 hours. Restoring the old key within that window loses nothing (see Changes key).{outcome="disabled"}in a burst instead means the key changed butkey_iddid not: every secret then fails to open as corrupt.{outcome="lease_lost"}: the subscription was deleted, or its lease taken over, while the attempt ran. Occasional is normal; steady means replicas are stalling past the 60-second lease (each attempt is bounded at 20 seconds, a batch at 40).{outcome="error"}above zero: a store or evaluation error, or an attempt that overran its bound; the warn log names the subscription. Nothing is recorded and the subscription is retried after its lease lapses.
Keyless signing
RFC-ACDP-0021 keyless signing ([keyless],
CONFIGURATION.md; wire behaviour in
HTTP-API.md)
is off by default. The profile is a 0.5.0 Draft.
Enabling. Set [keyless] enabled = true with at least one issuer or
trust domain. It needs [lifecycle] enabled = true, a [receipt] key and
[log] enabled = true; startup refuses it otherwise. The table it writes
(key_attestations) comes from migration 019, which this release adds and
every binary runs at startup whether keyless is on or off. It is additive,
with no backfill: it starts empty, and only mints write it (see
UPGRADING.md). Check /.well-known/acdp.json: profiles lists
acdp-registry-keyless and the keyless member names your issuers. To turn
it off, set enabled = false and restart; attestations already minted stay
public bodies, and bodies published under them stay stored and verifiable
by consumers that accept this registry as an attester.
Issuer allowlist. [[keyless.oidc_issuers]] and
[[keyless.spiffe_trust_domains]] are the only token issuers accepted and
the only places issuer keys are fetched from; a token from anywhere else is
issuer_not_accepted before any fetch. Issuers are compared byte for byte,
so list the exact iss your provider puts in tokens. Every identity that
mints must also be listed by its controller, in the controller DID
document's AcdpKeylessSigning service; the registry reads that, not its
own config, to authorize a mint. Each listing is public (RFC-ACDP-0021
§15): an attestation is a public body naming the controller, issuer and
subject, so do not list identities whose names are sensitive.
Issuer key fetching (JWKS posture). Keys are fetched over the same
SSRF-guarded outbound client as witnesses and hints (HTTPS only, public
unicast addresses only, no redirects), bounded by fetch_timeout_ms and
max_fetch_bytes, and cached in process per replica for
jwks_cache_ttl_seconds (60 to 3600; shortened by Cache-Control: max-age,
never below 60 s), one fetch per source at a time. A token naming an unknown
kid forces at most one refetch per source every 30 s. When a refetch
fails, the old copy keeps answering for up to jwks_max_stale_seconds
past its TTL (stale-if-error), and the source is not retried for 30 s.
With no usable copy, mints answer 502 key_resolution_unreachable
(issuer_unreachable) and the client should retry. A stale copy can hold a
key the issuer has since withdrawn, which is why jwks_max_stale_seconds
is capped at 7 days; shorten it if your issuers rotate keys after
compromise.
Clocks. Attestation windows, token exp/nbf/iat and the publish
window check (created_at inside [not_before, not_after)) all use the
replica's wall clock. Run NTP on every replica: a skewed clock refuses
valid tokens (token_invalid) or publishes (outside_attestation_window).
Rate limits. POST /key-attestations has two budgets, both per
replica: per client IP (rate_per_ip_per_minute, charged on arrival) and
per workload identity (rate_per_identity_per_minute, charged only after
the token verifies, so a caller without a valid token cannot exhaust an
identity's budget). Rejections are 429 rate_limited and count in
acdp_registry_rate_limit_rejections_total{scope="keyless_per_ip"} and
{scope="keyless_per_identity"}. The client IP is resolved as for every
other limiter (see Rate limiting).
Metrics and alerts. Suggested alerts:
acdp_registry_keyless_key_fetch_total{outcome!="ok"}rising: an issuer's keys cannot be fetched.policy_refusedmeans it resolves to a non-public address;bad_statusortransportmeans it is down.acdp_registry_keyless_key_stale_served_totalincreasing: mints are being verified against a stale key set; the issuer has been unreachable for longer than the TTL.acdp_registry_rate_limit_rejections_total{scope=~"keyless_.*"}sustained: a pipeline mints more often than its budget, or something is probing.
Receipt-key rotation. Attestations are signed with the receipt key.
Rotating it by the procedure in
RECEIPTS.md
(remove the old key from assertionMethod only, keep it in
verificationMethod) keeps every past attestation verifiable through its
own receipt. Removing a key from verificationMethod invalidates every
attestation it signed; do that only after a compromise.
Withdrawing an attestation. To withdraw one (a leaked workload token,
a compromised pipeline), retract it through the admin lifecycle endpoint,
POST /admin/contexts/{ctx_id}/retract (RFC-ACDP-0021 §9.2). Further
publishes under it are refused (attestation_withdrawn) and consumers
treat it as a registry-attested revocation of that key. A controller finds
every attestation minted for an identity with GET /key-attestations?controller=…&issuer=…&subject=… and revokes each
fingerprint itself (§9.3).
Webhooks
Receivers verify X-ACDP-Signature (GitHub-compatible HMAC-SHA256 over the raw
body). Delivery is non-blocking with exponential backoff (250 ms → cap 15 s) up
to webhook.max_retries; a full queue drops events with a warn. Full reference:
WEBHOOKS.md.
Observability
The binary emits JSON-structured tracing logs. The default filter is
info,acdp=info,acdp_registry=info; override with RUST_LOG. Every request
carries an x-request-id header (UUIDv4 if absent on input) propagated
downstream. At startup it logs the authority, port, storage backend, and
playground flag; on bind it logs the listen address; on SIGTERM/Ctrl-C it
drains in-flight requests for up to 30 s before exiting.
For numeric telemetry, enable the Prometheus /metrics endpoint (see
Metrics above); GET /admin/status remains the JSON snapshot for
queue/idempotency/migration state.
Backup and restore
Backup
Postgres: logical (pg_dump) or physical (pg_basebackup) backups as usual.
The contexts.body_json column is the canonical projection — body_json plus
status is enough to reconstruct every other index.
SQLite: stop the writer and copy the .db, .db-wal, and .db-shm files
atomically (or use the .backup command). Copying the .db alone while the
writer is running yields a torn database: recent commits live in the -wal.
Restore
The registry runs store.migrate() at startup, so a restored database is
brought to the current schema automatically. Restore the data before the
first boot against it; there is no online restore path.
- Stop the registry. Restoring under a live writer is what corrupts a
SQLite
-walset and what makes a Postgres restore race the migration. - Restore the data. Postgres:
pg_restoreinto an empty database (not a partially-populated one — the migrations are not written to merge two datasets). SQLite: put the.db,.db-waland.db-shmfiles back together, as a set. - If
[log]is enabled, settle the log instance before the first boot. A restore from any backup older than the last publish rolls the log back, and the firstGET /log/checkpointafter boot signs the restored tree under whateverlog_idis configured. If the restored tree may be smaller than a checkpoint the registry already served, change[log] instancebefore starting — see the runbook below. - Start the registry and watch the first boot. Migrations run before the
listener binds, so a schema failure is a startup failure, not a 500 later.
So is restoring a backup that holds lifecycle state (retractions or their
events, from a time
[lifecycle]was enabled) under a config with[lifecycle] enabled = false: RFC-ACDP-0013 §6 forbids serving that state without the profile, so the binary logs atERRORand exits non-zero. Set the flag to match the backup — see CONFIGURATION.md[lifecycle]. - If
[changes]is enabled, raise[changes] cursor_epochafter restoring an older backup. The restore rolls the feed'sseqback, and RFC-ACDP-0018 §5.3 requires refusing every cursor issued before the reset. The registry catches the dangerous ones without help: each cursor carries the feed head it was issued at and a fingerprint of that row, so a cursor issued past the backup point iscursor_expiredboth while it is beyond the restored head and after new entries reuse its numbers. A cursor issued before the backup point names rows the restore put back, so it still resumes, and it skips nothing. Only a value outside the database can expire it, which is what the epoch is for. SetACDP_REGISTRY_CHANGES__CURSOR_EPOCHto one more than its current value (unset means0) on every replica before the first boot. Every older cursor then answerscursor_expired, and consumers resync fromsinceabsent orhead(§7). Unlike a key rotation, the epoch leaves subscription secrets readable, so hints keep flowing. Never lower it: an epoch that comes back makes its old cursors valid again. - Verify readiness, not liveness.
GET /healthzreports storage readiness and answers503if the backend is not usable;GET /livezsays only that the process is up and will answer200against a broken database. Check/healthz.
What a restore does not bring back. The webhook delivery queue is in-memory
and bounded, with no outbox and no replay. Every event queued and not yet
delivered at the moment of the crash or shutdown is gone, and a restore cannot
reconstruct it — the events were never persisted. Consumers that missed a
context.published must re-derive state from the API rather than wait for a
redelivery that will never come.
Nonces (/auth/challenge) and issued-token revocation state live in their own
stores; restoring an older snapshot restores an older revocation list with it,
which can un-revoke a token that has not yet expired. Prefer rotating the
signing key over relying on a restored revocation list.
Capacity
There is no autoscaling story here and no built-in load shedding beyond the rate limiter. Five bounds are worth knowing before they find you:
| Bound | Where | What happens at the limit |
|---|---|---|
| Webhook queue | webhook.queue_capacity | The queue is bounded and delivery is fire-and-forget. When it is full the event is dropped with a warn log (webhook queue full; event dropped) — the publish itself still succeeds. There is no Prometheus gauge for depth; GET /admin/status reports queue_in_flight and queue_capacity, and that plus the warn log is the whole signal. |
| Transparency log proofs | [log] | Tree computation is O(n) per request over the stored leaf hashes (only the current head root is cached). /log/proof and /log/checkpoint therefore get steadily more expensive as the log grows, and they are unauthenticated for hash-only queries. Rate-limit them deliberately rather than discovering the cost. |
| Search page size | clamped in both stores | A caller-supplied limit is clamped to 100. A page can also come back shorter than requested when the request uses ?visibility=, which is applied after the query (tenant scoping is not: it runs in SQL) — see MULTI-TENANCY.md on the refill cap. Short is not "end of results"; page until next_cursor is absent. |
| Change feed | [changes] | Rows accumulate at one per lifecycle event, supersession and key revocation, whenever a [receipt] key is configured — served or not — and are pruned once older than retention_seconds plus a one-hour margin (the cutoff is this replica's clock, Postgres stamps rows with the database's) every prune_interval_seconds (default 3600; 1000 rows per batch, repeated until caught up). The prune task runs even with changes.enabled = false. A GET /changes request reads at most six scan batches of max(limit, 100) rows, so a requester who can see little of the feed gets short pages with has_more: true rather than an unbounded scan. Losing or rotating [changes] key material expires every outstanding cursor (consumers resync); it never corrupts the feed. |
| Storage pool | storage.max_connections (default 20) | Requests queue on the sqlx pool. /healthz issues a storage health query of its own, so it reports degraded + 503 once the pool can no longer serve one — which is the intended behaviour for a load balancer, and the reason /livez exists separately and never touches storage. |
Sizing the webhook queue is a trade between memory and loss: it holds whole deliveries in memory, and raising it raises the amount of work a crash discards (none of which is replayable). If deliveries are load-bearing, the honest answer is a consumer that reconciles against the API, not a larger queue.
Runbook: transparency-log inconsistency
Applies when [log] is enabled. A consistency proof (GET /log/proof?first=<a>&second=<b>)
is the mechanism that detects a log whose history changed underneath its
published checkpoints; RFC-ACDP-0012 §8.2 makes it REQUIRED for exactly that
reason. A monitor that has retained an earlier checkpoint and cannot verify it
against the current one has found a root rewrite.
What it means. The Merkle root is not stored independently — it is computed from the stored leaf hashes on every request. So a failed consistency proof does not indicate a corrupted root value. It indicates that the leaves themselves changed: rows removed, reordered, or rewritten. The realistic causes are a database restore that rolled the log back, a partial restore that mixed two datasets, or direct writes to the log table.
The rule every recovery must follow. RFC-ACDP-0012 §7.4
(pinned spec): a registry whose tree is lost MUST NOT serve a reconstructed
history under the same log_id; it MUST start a new instantiation with a new
<instance> component, and SHOULD publish an operational notice. "Serve" here
includes reads: GET /log/checkpoint is public and signs the current tree on
demand, so a registry that merely boots on a rolled-back database is already
signing the reconstructed history under the old log_id. (That reading of
"serve" is this runbook's, not the RFC's wording.) Restoring an older backup
and carrying on under the same log_id is therefore not a valid recovery
unless step 4 shows the restored tree is consistent with everything already
served.
This registry's log_id is did:web:<authority>/log/<instance>, where
<instance> is [log] instance (default "1"; env
ACDP_REGISTRY_LOG__INSTANCE; must match [a-z0-9-]{1,32}, checked at
startup). Changing it is a config change and a restart — no migration, no
manual SQL. Prefer setting it in the TOML file. If you must use the env var,
use a value that starts with a letter and is not nan, inf or infinity
(for example r2): the env source parses values that look like numbers before
they become a string, so 01 becomes 1, 1e3 becomes 1000, +1 becomes
1, nan becomes NaN (which fails the pattern) and infinity becomes inf — an env-only "new" instance can silently be the old one.
Either way, confirm the change took: the log_id in GET /log/checkpoint
must differ from the one served before. What the change does to existing
data, which you should state in your notice:
- The surviving leaves become the new log's history.
log_leaveshas no instance orlog_idcolumn, so nothing is deleted or renumbered: the rows still present keepleaf_index0 onward, the new log's first checkpoint commits to all of them (tree_sizeis the row count), and new publishes append after them. Under the newlog_idthose positions say nothing about when the entries were first published; the new log anchors them only from its own first checkpoint. (RFC-ACDP-0012 §7.4 is silent on whether a new instantiation may start non-empty; treating the relabelled leaves as time-unanchored is this runbook's reading, by analogy with §7.3.) - Witness cosignatures stop matching.
log_witness_cosignaturesrows are keyed bylog_id; the old rows stay in the table but are never attached to a new-log checkpoint, and the registry polls each[[witnesses]]entry for the newlog_id. The new log starts un-witnessed until the witnesses cosign it, so tell their operators. - Old proofs do not carry over. Consistency proofs exist only within one
log_id. Inclusion proofs and checkpoints consumers retained for the oldlog_idcannot be checked against the new one. That break is the intended, visible signal.
Do, in order:
- Preserve the evidence before touching anything. Snapshot the database and
keep the failing checkpoint pair (
first,second) and both responses. A second restore attempt destroys the only record of what the log claimed. - Take the registry out of service (stop it, or remove it from the load
balancer so clients cannot reach
/log/*). Every checkpoint it serves on the bad tree, and every entry appended on top of it, widens the set of checkpoints that can never be reconciled. The registry has no mechanism to repair a log in place, and none to reconcile two histories. - Find the largest checkpoint the registry may have served under the
current
log_id: from your monitors, a witness, a consumer report, or the pre-incident database (itsSELECT COUNT(*) FROM log_leavesis thetree_sizeit was serving). Compare it with the tree you are about to serve (the same count on the database you will run). - Decide the instance. Keep the current
log_idonly if the tree you will serve is at least as large as the largest served checkpoint and a consistency proof from that checkpoint to the new head verifies (fetchGET /log/proof?first=<served>&second=<current>with the registry reachable only by you, and check the proof with any RFC 6962 consistency-proof verifier; the response shape is RFC-ACDP-0012 §8.2 and the verification algorithm §9.2). The proof needs the root of a checkpoint you actually retained (monitor or witness), not just a row count. Otherwise — the restored tree is smaller, the root differs, or you cannot show either way — set a new[log] instance(for example"1"→"2") before the registry is reachable again. On a public registry you can rarely rule out an unseen checkpoint, so expect to change it after any rollback. (This is operator guidance, stricter than §7.4's wording.) - If it was a rollback from a restore: contexts published after the backup
are gone from this registry, along with their leaves. Their producers have
to re-publish them, which mints new
ctx_ids and new leaves in the new log. Say so explicitly to consumers. - If it was not a restore: treat it as a possible compromise of whatever has write access to the log table, and follow the rotation steps below. A rewrite that nobody performed deliberately means something else can write there. The instance decision in step 4 applies here too.
- Tell the monitors and witnesses (the operational notice §7.4 asks for).
A consistency failure is the signal the transparency log exists to produce;
a registry that resolves one silently has removed the only reason a consumer
would trust it. Publish what happened, the old and new
log_id, the affectedtree_sizerange, and whether entries were lost.
Key rotation
- HS256 — set a new
ACDP_REGISTRY_AUTH__JWT_SECRETand restart. Outstanding tokens become invalid immediately; clients re-run challenge-response. - EdDSA — rotate
auth.jwt_private_key_pem(and optionallyjwt_kid) and restart; the new public key is published at/.well-known/jwks.json. Outstanding tokens stop verifying once the old public key is gone — coordinate with federated verifiers that cache the JWKS (300 smax-age).
For targeted revocation without rotating the signing key, use
POST /auth/token/revoke (see AUTHENTICATION.md).
Admin tokens
auth.admin_tokens is a list, which is what makes rotation possible without
a window of refused admin requests:
- Append the new token to
auth.admin_tokensand restart. Both old and new are now accepted. - Move every caller — deploy scripts, dashboards, whatever calls
/admin/*— to the new token. - Remove the old entry and restart.
Two things to know before you start. Emptying the list does not leave
/admin/* open: an empty list disables every admin-bearer-gated route outright
(/admin/status, /admin/contexts, the audit, retract and republish routes,
and /admin/pinned-keys/reload). And entries are compared with no trimming on
/admin/* — a token with stray leading or trailing whitespace is rejected there
while being accepted on other routes over HTTP/1.1, which is why startup
validation refuses such entries outright. See
AUTHENTICATION.md for the full parser comparison.
Webhook signing secret
webhook.secret keys the HMAC-SHA256 in X-ACDP-Signature and in
X-ACDP-Signature-Timestamped (the opt-in freshness signature — see
WEBHOOKS.md). One secret keys both, so rotation
below covers both; a receiver verifying either one is affected identically.
There is no multi-secret list and no overlap window: the registry signs with
exactly one secret, so the moment you rotate, deliveries signed with the old
secret stop verifying at the receiver.
Rotate from the receiving side, not the sending side:
- Teach the receiver to accept either secret — verify against the new one, and fall back to the old on mismatch.
- Change
webhook.secretand restart the registry. - Once no delivery has verified against the old secret for longer than your retry window, drop the fallback.
Rotating the registry first inverts this into an outage: every event in flight during the change is signed with a secret the receiver rejects, and because the delivery queue is in-memory with no outbox, a delivery that exhausts its retries is gone rather than deferred.
Receipt signing key
Receipt-key rotation has its own procedure and a retention rule that must not be violated — a removed key invalidates every receipt it ever signed. It is documented in RECEIPTS.md, not here.
Changes key
The [changes] master key (see
CONFIGURATION.md) does two jobs: it
authenticates GET /changes cursors, and it seals every subscription
secret at rest (AES-256-GCM, bound to the subscription id). The plaintext
secret is never stored, so a database dump alone cannot forge hints.
Rotating the key (new key, new key_id) has two effects:
- every outstanding cursor becomes
cursor_expired, and consumers resync; - every existing subscription's secret can no longer be opened. The hint
worker sends nothing for it and retries on the normal backoff
(
outcome="unknown_key"), so putting the old key back within 72 hours (a rollback, a replica deployed with the wrong key) resumes it with nothing lost. After 72 hours it is disabled,GET /subscriptions/{id}showsstatus: "disabled", and the owner must delete it and create a new one, which gets a new secret.
Always change key_id together with the key. A new key under the same
key_id cannot be told apart from a tampered secret, so every
subscription is disabled at once.
Every replica needs the same key and key_id. Keep the key out of the
database backup set: a backup together with the key opens every secret.