Engineering guide · Architecture
Remote Authorization PDP Boundary
On this page
Endpoint contractDurable one-time replay authorityRequired configurationCertificate profileFailure behaviorapi-gateway is the only accepted caller of the remote atlas-authz decision API.
The remote boundary uses two independent authentication layers:
-
TLS 1.3 verifies the PDP server against an explicitly configured CA and exact server name. The gateway presents a client certificate. The PDP verifies that certificate against its explicitly configured client CA and requires exactly one URI SAN equal to the configured gateway SPIFFE ID.
-
A short-lived HS384 workload JWT binds issuer
atlas-api-gateway, subjectauthorization-pdp-client, audienceatlas-authz, the required operation scope, and the SHA-256 of the exact JSON request bytes.
Possession of only a certificate or only the workload-signing key is insufficient. The PDP evaluates a request only after both layers succeed. Decision responses retain their separate response-signature verification at the gateway.
Endpoint contract
| Method | Path | Workload scope | Additional authorization |
|---|---|---|---|
|
|
|
Exact gateway mTLS identity |
|
|
|
Exact gateway mTLS identity |
|
|
|
Exact gateway mTLS identity plus the policy-simulation capability evaluated by the PDP |
|
|
none |
Server-authenticated TLS; liveness only |
|
|
none |
Server-authenticated TLS; reports policy-catalog readiness and integrity degradation |
The service-owned OpenAPI 3.1.1 document is at /openapi.json; the self-hosted Swagger UI is at /docs/.
Decision operations declare the combined bearerAuth and mutualTLS security requirement.
Swagger “try it” remains disabled unless explicitly enabled and cannot substitute for a workload client certificate.
Durable one-time replay authority
After signature and claim validation, atlas-authz hashes the JWT ID with SHA-256 and tries to insert the digest and token expiry into atlas_authz_workload_jti_consumptions in PostgreSQL.
The unique primary key is the cross-replica arbitration point:
-
one transaction can insert and commit a JTI digest;
-
a conflicting insert returns no row and the request is denied;
-
a database, transaction, cleanup, or commit failure returns
503and no decision is evaluated; -
only expired rows are eligible for bounded cleanup, 256 rows per request;
-
update is forbidden and an unexpired row cannot be deleted;
-
the JWT, bearer header, plaintext JTI, claims, and request body are not persisted in this authority.
The retention window is deliberately short because workload tokens have a maximum one-minute lifetime.
Migration 111_atlas_authz_workload_replay.sql is mirrored byte-for-byte in the root and embedded identity migration sets.
Required configuration
Gateway:
| Variable | Contract |
|---|---|
|
HTTPS origin only; credentials, path, query, and fragment are rejected |
|
Absolute path to the dedicated PDP server CA bundle |
|
Exact DNS or IP identity verified from the PDP certificate |
|
Absolute path to the gateway client certificate chain with client-auth EKU |
|
Absolute path to the matching private key |
|
Independent secret of at least 32 bytes |
|
Independent decision response verification key |
PDP:
| Variable | Contract |
|---|---|
|
Absolute path to the PDP server certificate chain with server-auth EKU |
|
Absolute path to the matching server private key |
|
Absolute path to the gateway-client issuing CA bundle |
|
Exact |
|
Authoritative policy and JTI-consumption PostgreSQL database |
|
Same independent workload JWT verification secret configured at the gateway |
|
Same independent response-signing key configured at the gateway |
There is no HTTP downgrade, system-root trust fallback, inferred server name, anonymous decision path, in-memory production replay cache, or hard-coded signing-key fallback.
Missing or invalid material prevents construction of the remote gateway client or prevents atlas-authz from starting.
Certificate profile
Use a private workload CA or a constrained intermediate, not a public web PKI certificate.
The PDP server certificate must contain the exact name configured by the gateway and permit server authentication.
The gateway client certificate must permit client authentication and contain exactly one URI SAN matching ATLAS_AUTHZ_TLS_CLIENT_SPIFFE_ID, for example:
spiffe://atlas.internal/workload/api-gateway
Certificate and signing-key rotation are separate operations. During a CA rotation, deploy an overlap bundle deliberately, keep the URI identity unchanged, and remove the retired CA after every gateway replica has moved. Do not weaken hostname verification or enable insecure TLS as a rotation workaround.
Failure behavior
| Failure | Result |
|---|---|
Missing, untrusted, expired, or wrong-name PDP certificate |
Gateway TLS connection fails; authorization fails closed |
Missing, untrusted, wrong-EKU, or wrong-URI client certificate |
PDP returns no decision |
Missing, invalid, expired, wrong-scope, or request-mismatched workload JWT |
|
Reused JTI on any replica |
|
PostgreSQL replay authority unavailable |
|
Invalid or expired signed decision response |
Gateway rejects the response |
Focused tests generate an ephemeral CA, server identity, and client identities; exercise a real TLS 1.3 handshake; reject HTTP and wrong server names; reject missing and wrong SPIFFE identities; demonstrate a shared cross-replica replay denial; and verify the SQL migration and hash-only transaction contract.