This document captures two production-grade integration paths for using Atom as an authorization layer for third-party search/listing services.
- Path 2: Atom-backed authorized listing API (Atom/DB is source of truth for listing authorization).
- Path 3: Search index with ACL projection (search engine performs most filtering with projected auth data).
Option 1 (per-item check fanout) is intentionally excluded.
Build a first-class listing endpoint in Atom, e.g. POST /authz/resources/search, that:
- Authenticates caller.
- Resolves subject from bearer token (server-side).
- Applies policy semantics in Atom/Postgres.
- Returns only resources the subject is allowed to see for a given action.
- Strong consistency: policy/group/resource changes are reflected immediately.
- Full semantic fidelity with Atom PDP behavior (deny-overrides-allow, default deny, ABAC conditions).
- Easier auditability and explainability (
reason, policy traceability). - Lower operational complexity than maintaining a second policy system in search infra.
- Query path is DB-bound and can become expensive for very large search workloads.
- Requires careful SQL design and indexing to keep p95/p99 low.
- Offset-based pagination does not scale well for deep pagination.
- Prefer keyset/cursor pagination over offset.
- Keep request contract explicit:
- Required:
action, filters, page cursor/limit. - Optional:
contextfor ABAC.
- Required:
- Enforce subject binding from token, not caller-supplied subject IDs.
- Add explicit metrics: latency, rows scanned, denied/allowed ratio, tenant hot spots.
Mirror resources and authorization-relevant data into a search index (Elasticsearch/OpenSearch/etc.) and execute most listing filters there, including ACL filters.
- Best scalability for high-QPS listing/search.
- Better support for relevance ranking, faceting, and large candidate sets.
- Horizontal read scaling is usually simpler than scaling relational authorization joins alone.
- Higher operational complexity (CDC/outbox, projector, replay, reconciliation, lag monitoring).
- Eventual consistency risk unless strong synchronization barriers are added.
- Easy to drift from true PDP semantics, especially for:
- deny precedence
- group/role churn
- dynamic ABAC inputs (
context.*)
- Harder to provide correct "why allowed/denied" explanation unless explicitly engineered.
- Treat Atom as source of truth; index is a derived projection.
- Build idempotent projector with replay support and tombstone handling.
- Instrument end-to-end lag from Atom write timestamp to searchable state.
- Keep a fallback path to Path 2 for consistency-sensitive flows.
- Path 2 is the correct first production target for correctness and policy fidelity.
- Path 3 is the scale optimization path, not the initial trust anchor.
- The biggest migration risk is semantic drift from Atom PDP behavior.
- ABAC clauses should be classified:
- Index-safe/static clauses can be projected.
- Dynamic/request-context clauses should stay in Atom evaluation or force fallback.
- Even after Path 3 rollout, Path 2 should remain available as a correctness fallback.
- Ship
POST /authz/resources/searchwith strict subject-from-token semantics. - Add deterministic response shape and cursor pagination.
- Add integration tests that compare results against per-resource PDP truth.
- Implement CDC or outbox for changes affecting listing authorization:
- resources
- policy_bindings
- groups/group_members
- roles/role_capabilities
- entity attributes/status relevant to ABAC
- Define index documents for resource metadata + projected ACL fields.
- Ensure idempotent upsert/delete and replay-from-offset.
- Store version/watermark metadata for drift detection.
- Execute Path 3 in shadow mode for sampled requests.
- Compare Path 3 results against Path 2.
- Log divergence with reproducible diagnostics.
- Enable Path 3 by tenant/workload segment.
- Keep auto-fallback to Path 2 when:
- lag threshold exceeded
- divergence threshold exceeded
- unsupported ABAC context is present
- Path 3 serves high-scale search/listing traffic.
- Path 2 remains canonical fallback and safety path.
- Run periodic reconciliation jobs and alert on drift.
- Choose Path 2 only if workload is moderate and strict consistency is required.
- Choose Path 2 then Path 3 for large-scale search where low latency and advanced search features matter.
- Avoid direct Path 3-first rollout unless you are ready to absorb the complexity of correctness validation and continuous reconciliation.