All integrations
PostgreSQL
Context sources

Enrich Cerbos authorization with PostgreSQL context

Automatically enrich authorization requests with real-time data from PostgreSQL, richer decisions without changing application code.

PostgreSQL data source

PostgreSQL data source

Query PostgreSQL directly from Cerbos using the built-in sqldb data source

Cached responses

Cached responses

Configurable TTLs cache query results to balance data freshness against evaluation latency

Zero application code

Zero application code

Data enrichment happens at the policy layer, your application code stays clean

How Cerbos works with PostgreSQL

Authorization decisions are only as good as the data behind them. PostgreSQL provides real-time context (user profiles, group memberships, or external attributes) that makes Cerbos policies richer and more accurate.

Cerbos lets you write fine-grained, context-aware authorization policies in human-readable YAML. With PostgreSQL as a context source, those policies can evaluate attributes beyond what's in the initial request.

Because enrichment happens at the policy layer, your application code stays clean, no custom plumbing to fetch and merge identity data before making authorization calls.

How Cerbos uses PostgreSQL

  1. Configure PostgreSQL as a context source, Register PostgreSQL in your Cerbos configuration so Cerbos can fetch external attributes at decision time.
  2. Cerbos fetches attributes at decision time, When a policy references external data, Cerbos retrieves it from PostgreSQL automatically.
  3. Policies evaluate with enriched context, Authorization rules can use live attributes, group memberships, feature flags, or business context, for richer decisions.
  4. No application code changes required, Context enrichment is handled at the policy layer, keeping your application code clean.

FAQ

How does Cerbos use data from PostgreSQL?

Cerbos can enrich authorization requests with context from PostgreSQL — such as user profiles, group memberships, or custom attributes, so policies can make decisions based on real-time data rather than just token claims.

Do I need to change my application code?

No. Context enrichment is configured at the policy layer. Your application makes the same authorization call and Cerbos handles fetching the additional context from PostgreSQL transparently.

Cerbos + PostgreSQL

  • Authorization decisions enriched with real-time PostgreSQL data
  • Context enrichment configured at the policy layer, not in application code
  • Identity attributes and business context combined in policies
  • Centrally managed authorization logic across the stack

What is Cerbos?

Cerbos is an end-to-end enterprise authorization software for Zero Trust environments and AI-powered systems. It enforces fine-grained, contextual, and continuous authorization across apps, APIs, AI agents, MCP servers, services, and workloads.

Cerbos consists of an open-source Policy Decision Point, Enforcement Point integrations, and a centrally managed Policy Administration Plane (Cerbos Hub) that coordinates unified policy-based authorization across your architecture. Enforce least privilege & maintain full visibility into access decisions with Cerbos authorization.