Expand description
Cedar adapter for the engine-neutral policy layer (datafusion-policy).
The neutral crate (datafusion_policy) owns the decide/enforce split — the
PolicyEngine trait, the PolicyQueryPlanner enforcement hook, the plan
rewrite, and all neutral types. This crate is one adapter behind that
seam: it implements PolicyEngine with Cedar
(CedarPolicyEngine), lowers the neutral principal to Cedar entities
(principal_entities), lowers the neutral plan-action list to Cedar
authorization requests, and reads Cedar partial-eval residuals into
DataFusion predicates (CedarResidualTranslator). Policy sourcing
(pulling a policy set / schema / entities from an OCI registry) lives in the
cedar-oci crate; engine-specific glue
(extracting the principal from a request, composing onto a session) lives in
the host — see hydrofoil for a
reference host.
The neutral core’s public surface (PolicyEngine, PrincipalIdentity,
PolicyExtension, …) is re-exported here so a Cedar host has a single
import surface.
Structs§
- Abac
Policy Engine - A
PolicyEnginethat enforces UC ABACPolicyBindings directly. - Agent
Claims - Agent-identity claims (OIDC-A). A placeholder seam carried on
PrincipalClaims; agent principal-enrichment is deferred to the agent-PEP work, so the v1 identity provider ignores it. - Catalog
Fact Sink - A per-query sink the catalog writes
TableFactsinto and the Cedar policy reads. Interior-mutable and cheap to clone (Arc<DashMap>), so the same instance reaches bothbuild_delta(during resolution) and the policy layer (during evaluation) through aSessionConfigextension. - Catalog
Fact Sink Ext - The
SessionConfigextension carrying the per-queryCatalogFactSinkthe catalog writes resource facts into and the policy layer reads. - Cedar
Policy Engine - A
PolicyEnginebacked by a CedarAuthorizer. - Cedar
Residual Translator - Reads a Cedar residual’s typed PST and lowers its condition to an
Expr. - Column
Match - A
MATCH COLUMNSmatcher: the columns whose governed tags satisfyconditionare exposed to the function underalias. - Default
Principal Matcher - The default
PrincipalMatcher: strips anEntityType::"..."wrapper off both the binding name and the principal’s uid/groups before a case-sensitive compare, and treats theaccount userssentinel as matching every principal. - Entity
- Entity datatype
- Entity
Id - Identifier portion of the
EntityUidtype. - Entity
Type Name - Represents an entity type name. Consists of a namespace and the type name.
- Entity
Uid - Unique id for an entity, such as
User::"alice". - Eval
Context - Per-query, non-plan facts threaded into the
PolicyEnginelayer. - Fact
Store Ext - The
SessionConfigextension carrying the session’s taint ledger, attached to the per-query state so the policy layer can build theEvalContext. - Function
Resolver Ext - The
SessionConfigextension carrying the catalog function resolver, so the governance PEP can turn a policy-referenced masking / row-filter function name into a callableScalarUDF. - Governance
- A fully-assembled governance profile: the policy engine plus the optional
identity / function / fact-store providers, and the runtime
Posture. - Governance
Builder - Builder for
Governance. SeeGovernance::builder. - Group
- A node in the neutral group hierarchy: a group uid and its direct parent
group uids. The transitive closure of a principal’s groups (each group plus
its ancestors) so
privileged_readers ⊂ readersresolves without a static entity bundle. - InMemory
Fact Store - In-memory
FactStorebacked by aDashMapkeyed by correlation id. - InMemory
Policy Provider - An in-memory
SimplePolicySetProvider+SimpleEntityProviderholding a fixed policy set and entity bundle. - Policy
Binding - One parsed UC ABAC policy: principals × tag-matched securable/columns → a row-filter or column-mask function call.
- Policy
Builder - Builds and installs policy enforcement on a
SessionState. - Policy
Extension - Entry point for instrumenting a DataFusion session with Cedar policy enforcement.
- Policy
Query Planner - A
QueryPlannerthat governs and gates a query before physical planning. - Principal
Claims - Neutral, transport-free claims the host passes to an
IdentityProvider. - Principal
Enrichment - The facts an
IdentityProviderresolves for a principal: attributes to fold onto the principal, the principal’s direct group parents, and the transitive group hierarchy needed forinto resolve the ancestry. - Principal
Ext - The
SessionConfigextension carrying the per-request principal. - Principal
Identity - The principal on whose behalf a query executes, plus the attributes policies
may condition on (e.g.
role,region,name) and the group memberships they resolveinagainst. - Restricted
Expression - “Restricted” expressions are used for attribute values and
context. - Session
Config Eval Context Provider - An
EvalContextProviderthat assembles theEvalContextfrom the session’sSessionConfigextensions: the catalog fact sink and (underfgac) the correlation id + taint ledger. The correlation id is the session id, stable per connection. - Session
Config Principal Provider - A
PrincipalProviderthat reads thePrincipalIdentityattached to the session’sSessionConfigas aPrincipalExtextension. - Static
Policy Engine - A
PolicyEnginethat returns the same decision for every query. - Table
Facts - Catalog-derived attributes of one table, gathered at resolution time and
folded into the Cedar
Tableresource entity. The host builds this from its catalog metadata (UCTable.owner/properties/comment); the Cedar layer reads only this neutral shape. - Table
Policy - The fine-grained enforcement that applies to one table for one principal.
- TagCondition
- A governed-tag matcher:
hasTag(key)whenvalueisNone,hasTagValue(key, value)otherwise.
Enums§
- Attr
Value - An engine-neutral principal attribute value.
- Binding
Kind - Whether a binding installs a row filter or a column mask — the two UC ABAC policy kinds.
- Decision
- The coarse allow/deny outcome of an authorization decision.
- Function
Arg - One argument to a binding’s function: either a column bound by a
ColumnMatchalias, or a constant passed through as a literal. - Identity
Error - An error resolving identity facts. Small and crate-local so the host owns the
fail-closed decision (an
Errshould fail the session, not proceed un-enriched). - Plan
Action - An access-relevant operation discovered in a logical plan.
- Posture
- The runtime enforcement stance, chosen once at build time so an ungoverned session is never the accidental result of a forgotten wire-up.
Traits§
- Catalog
Function Resolver - Resolves a catalog function name into a callable DataFusion
ScalarUDF. - Constraint
Translator - Translates an engine’s residual into a DataFusion row-filter predicate.
- Eval
Context Provider - Assembles the per-query
EvalContextfrom the planningSession. - Fact
Store - Shared, session-scoped facts keyed by a correlation id (the session/trace id). v1 exposes only the monotonic taint ledger.
- Identity
Provider - The principal/identity PIP: given the authenticated principal uid (plus any validated claims), pull the slice of identity facts policies condition on — attributes and group membership.
- Policy
Engine - The decide contract every policy engine implements — the engine-agnostic seam the enforcement layer talks to.
- Policy
Session Ext SessionContextergonomics for policy instrumentation.- Principal
Matcher - Decides whether a
PolicyBinding’s principal lists match the queryingPrincipalIdentity— a small seam so a host can override the name-normalization / all-users semantics its directory uses. - Principal
Provider - Resolves the principal a query runs as, from the planning
Session. - Simple
Entity Provider SimpleEntitySetProvidertrait provides a simple trait for gathering entities. Some use cases include getting data from a simple file system location or a database call.- Simple
Policy SetProvider SimplePolicySetProvidertrait provides a simple trait for gathering policy set data. Some use cases would be getting data out of a file or a database call.
Functions§
- authorize_
and_ govern - Govern
plan(row filters + column masks), then gate the optimized plan on the coarse access policy — the shared enforcement sequence. - authorize_
and_ govern_ with_ posture - Govern + gate
planunder an explicitPosture. - govern_
plan - Inject row filters and column masks for each governed table.
- instrument_
session_ state - Instrument
statewith an explicit policy and providers. - normalize
- Normalize a
TableReferenceto its fully-qualified form so the key the catalog writes (catalog.schema.table, built from UC metadata) matches the key the plan’sTableScancarries (which may be bare/partial before resolution). Both therecordandgetsides normalize, so abare("t")and afull("c","s","t")referring to the same table resolve to one entry only when they share the same qualified name; refs that genuinely differ stay distinct. - parse_
uid - Parse a neutral uid string (e.g.
User::"alice") into a CedarEntityUid. - plan_
actions - Walk
planand return the neutralPlanActions that must be authorized for it to run. An engine adapter lowers each action to its own request. - principal_
entities - The principal entity plus the transitive group entities rebuilt from the
neutral hierarchy — the full set to hand to
Entities::from_entities. This is what makes group membership resolve without a static entity bundle.