Engineering guide · Architecture

Remote Authorization PDP Boundary

Status: currentReviewed: 2026-07-27Audience: backend developers, security engineers, operators
On this pageEndpoint contractDurable one-time replay authorityRequired configurationCertificate profileFailure behavior

api-gateway is the only accepted caller of the remote atlas-authz decision API. The remote boundary uses two independent authentication layers:

  1. 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.

  2. A short-lived HS384 workload JWT binds issuer atlas-api-gateway, subject authorization-pdp-client, audience atlas-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

POST

/v1/decisions

authorization.decide

Exact gateway mTLS identity

POST

/v1/decisions/batch

authorization.decide

Exact gateway mTLS identity

POST

/v1/decisions/explain

authorization.explain

Exact gateway mTLS identity plus the policy-simulation capability evaluated by the PDP

GET

/healthz

none

Server-authenticated TLS; liveness only

GET

/readyz

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 503 and 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

ATLAS_AUTHZ_PDP_URL

HTTPS origin only; credentials, path, query, and fragment are rejected

ATLAS_AUTHZ_PDP_TLS_CA_FILE

Absolute path to the dedicated PDP server CA bundle

ATLAS_AUTHZ_PDP_TLS_SERVER_NAME

Exact DNS or IP identity verified from the PDP certificate

ATLAS_AUTHZ_PDP_TLS_CLIENT_CERT_FILE

Absolute path to the gateway client certificate chain with client-auth EKU

ATLAS_AUTHZ_PDP_TLS_CLIENT_KEY_FILE

Absolute path to the matching private key

ATLAS_AUTHZ_WORKLOAD_SIGNING_KEY

Independent secret of at least 32 bytes

ATLAS_AUTHZ_DECISION_SIGNING_KEY

Independent decision response verification key

PDP:

Variable Contract

ATLAS_AUTHZ_TLS_CERT_FILE

Absolute path to the PDP server certificate chain with server-auth EKU

ATLAS_AUTHZ_TLS_KEY_FILE

Absolute path to the matching server private key

ATLAS_AUTHZ_TLS_CLIENT_CA_FILE

Absolute path to the gateway-client issuing CA bundle

ATLAS_AUTHZ_TLS_CLIENT_SPIFFE_ID

Exact spiffe:// URI SAN accepted for decision calls

ATLAS_AUTHZ_DATABASE_URL

Authoritative policy and JTI-consumption PostgreSQL database

ATLAS_AUTHZ_WORKLOAD_SIGNING_KEY

Same independent workload JWT verification secret configured at the gateway

ATLAS_AUTHZ_DECISION_SIGNING_KEY

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

401

Reused JTI on any replica

401

PostgreSQL replay authority unavailable

503

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.