Skip to main content

Crate olai_datafusion_policy_cedar

Crate olai_datafusion_policy_cedar 

Source
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§

AbacPolicyEngine
A PolicyEngine that enforces UC ABAC PolicyBindings directly.
AgentClaims
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.
CatalogFactSink
A per-query sink the catalog writes TableFacts into and the Cedar policy reads. Interior-mutable and cheap to clone (Arc<DashMap>), so the same instance reaches both build_delta (during resolution) and the policy layer (during evaluation) through a SessionConfig extension.
CatalogFactSinkExt
The SessionConfig extension carrying the per-query CatalogFactSink the catalog writes resource facts into and the policy layer reads.
CedarPolicyEngine
A PolicyEngine backed by a Cedar Authorizer.
CedarResidualTranslator
Reads a Cedar residual’s typed PST and lowers its condition to an Expr.
ColumnMatch
A MATCH COLUMNS matcher: the columns whose governed tags satisfy condition are exposed to the function under alias.
DefaultPrincipalMatcher
The default PrincipalMatcher: strips an EntityType::"..." wrapper off both the binding name and the principal’s uid/groups before a case-sensitive compare, and treats the account users sentinel as matching every principal.
Entity
Entity datatype
EntityId
Identifier portion of the EntityUid type.
EntityTypeName
Represents an entity type name. Consists of a namespace and the type name.
EntityUid
Unique id for an entity, such as User::"alice".
EvalContext
Per-query, non-plan facts threaded into the PolicyEngine layer.
FactStoreExt
The SessionConfig extension carrying the session’s taint ledger, attached to the per-query state so the policy layer can build the EvalContext.
FunctionResolverExt
The SessionConfig extension carrying the catalog function resolver, so the governance PEP can turn a policy-referenced masking / row-filter function name into a callable ScalarUDF.
Governance
A fully-assembled governance profile: the policy engine plus the optional identity / function / fact-store providers, and the runtime Posture.
GovernanceBuilder
Builder for Governance. See Governance::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 ⊂ readers resolves without a static entity bundle.
InMemoryFactStore
In-memory FactStore backed by a DashMap keyed by correlation id.
InMemoryPolicyProvider
An in-memory SimplePolicySetProvider + SimpleEntityProvider holding a fixed policy set and entity bundle.
PolicyBinding
One parsed UC ABAC policy: principals × tag-matched securable/columns → a row-filter or column-mask function call.
PolicyBuilder
Builds and installs policy enforcement on a SessionState.
PolicyExtension
Entry point for instrumenting a DataFusion session with Cedar policy enforcement.
PolicyQueryPlanner
A QueryPlanner that governs and gates a query before physical planning.
PrincipalClaims
Neutral, transport-free claims the host passes to an IdentityProvider.
PrincipalEnrichment
The facts an IdentityProvider resolves for a principal: attributes to fold onto the principal, the principal’s direct group parents, and the transitive group hierarchy needed for in to resolve the ancestry.
PrincipalExt
The SessionConfig extension carrying the per-request principal.
PrincipalIdentity
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 resolve in against.
RestrictedExpression
“Restricted” expressions are used for attribute values and context.
SessionConfigEvalContextProvider
An EvalContextProvider that assembles the EvalContext from the session’s SessionConfig extensions: the catalog fact sink and (under fgac) the correlation id + taint ledger. The correlation id is the session id, stable per connection.
SessionConfigPrincipalProvider
A PrincipalProvider that reads the PrincipalIdentity attached to the session’s SessionConfig as a PrincipalExt extension.
StaticPolicyEngine
A PolicyEngine that returns the same decision for every query.
TableFacts
Catalog-derived attributes of one table, gathered at resolution time and folded into the Cedar Table resource entity. The host builds this from its catalog metadata (UC Table.owner/properties/comment); the Cedar layer reads only this neutral shape.
TablePolicy
The fine-grained enforcement that applies to one table for one principal.
TagCondition
A governed-tag matcher: hasTag(key) when value is None, hasTagValue(key, value) otherwise.

Enums§

AttrValue
An engine-neutral principal attribute value.
BindingKind
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.
FunctionArg
One argument to a binding’s function: either a column bound by a ColumnMatch alias, or a constant passed through as a literal.
IdentityError
An error resolving identity facts. Small and crate-local so the host owns the fail-closed decision (an Err should fail the session, not proceed un-enriched).
PlanAction
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§

CatalogFunctionResolver
Resolves a catalog function name into a callable DataFusion ScalarUDF.
ConstraintTranslator
Translates an engine’s residual into a DataFusion row-filter predicate.
EvalContextProvider
Assembles the per-query EvalContext from the planning Session.
FactStore
Shared, session-scoped facts keyed by a correlation id (the session/trace id). v1 exposes only the monotonic taint ledger.
IdentityProvider
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.
PolicyEngine
The decide contract every policy engine implements — the engine-agnostic seam the enforcement layer talks to.
PolicySessionExt
SessionContext ergonomics for policy instrumentation.
PrincipalMatcher
Decides whether a PolicyBinding’s principal lists match the querying PrincipalIdentity — a small seam so a host can override the name-normalization / all-users semantics its directory uses.
PrincipalProvider
Resolves the principal a query runs as, from the planning Session.
SimpleEntityProvider
SimpleEntitySetProvider trait provides a simple trait for gathering entities. Some use cases include getting data from a simple file system location or a database call.
SimplePolicySetProvider
SimplePolicySetProvider trait 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 plan under an explicit Posture.
govern_plan
Inject row filters and column masks for each governed table.
instrument_session_state
Instrument state with an explicit policy and providers.
normalize
Normalize a TableReference to its fully-qualified form so the key the catalog writes (catalog.schema.table, built from UC metadata) matches the key the plan’s TableScan carries (which may be bare/partial before resolution). Both the record and get sides normalize, so a bare("t") and a full("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 Cedar EntityUid.
plan_actions
Walk plan and return the neutral PlanActions 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.