Repository navigation
Description
Summary
Add an OPA PDP builtin that evaluates Rego policies in-process, alongside the existing cedar-direct and cel PDPs. Back it with
regorus, a pure-Rust Rego interpreter (Apache-2.0), so we get embedded evaluation with no sidecar and no network hop.
PdpDialect::Opa already exists in apl-core; this issue fills it with a resolver.
Motivation
Operators standardized on OPA/Rego have no in-process option today. Their choices are Cedar, CEL, or an external OPA over HTTP. An embedded Rego backend lets them reuse existing policy without a sidecar, matching the deployment model of the other builtin PDPs.
Scope
New crate builtins/pdps/opa (cpex-pdp-opa), mirroring the shape of builtins/pdps/cel:
OpaResolverimplementingPdpResolver,dialect() -> PdpDialect::Opa.OpaPdpFactoryimplementingPdpFactory,kind() = "opa", built from the
global.pdpconfig block.AttributeBag→ Regoinputdocument (reuse the bag→namespace mapping the
CEL resolver already does; the flat dotted keys become nestedinput
fields).- Compile-once / eval-many: parse policy modules at factory build time, hold
the prepared engine, evaluate per request. - Decision contract: the configured query must resolve to a boolean
allow/deny.on_error: deny | allow(defaultdeny), matching CEL/Cedar. - Route step form
opa: { ... }carrying the module(s) + query path; keep it
consistent with howcel: { expr }andcedar: { ... }read.
Wire an optional opa feature into cpex-builtins (one feature → one crate, like the others) and add it to default.
Acceptance Criteria
Scenario: allow decision from an embedded Rego policy
Given a route with an `opa:` step and a Rego module that allows the request
When the PDP step evaluates
Then the resolver returns allow and the pipeline continues
Scenario: deny on evaluation error honors on_error
Given an `opa` PDP configured with on_error: deny
When policy evaluation errors
Then the request is deniedNotes
- regorus is Apache-2.0 and pure Rust — no new entries needed in the
deny.tomllicense allow list, no C/sidecar dependency. - Keep the crate
apl-core-only at compile time (apl-cpex/cpex-core as dev-deps for e2e tests), same ascelandcedar-direct.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity