Core Concepts

Builtins

PPE ships a set of plugins, decision points, and a session store, each behind a Cargo feature.

Praxis Policy Engine v0.7.0 7 min read
On this page

PPE ships a set of plugins, decision points, and a session store, each behind a Cargo feature. With a feature enabled, praxis_policy::install_builtins registers its factory and a policy can name it by kind.

Catalog

KindTypeFeaturePurpose
identity/jwtidentityjwtResolve a subject from a verified JWT, with configurable claim mapping. See Identity.
identity/api-keyidentityapi-keyResolve an API key against a file or HTTP directory. See Recipe 7.
delegator/oauthdelegatoroauthRFC 8693 token exchange, with optional caching. See Delegation.
delegator/vaultdelegatordelegator-vaultResolve caller-scoped or workload-owned downstream credentials from Vault KV v2. See Vault delegation recipes.
elicitation/cibaelicitationelicitation-cibaOIDC CIBA human approval. See Elicitation.
cedar-directdecision pointcedarEvaluate Cedar policy (dialect cedar).
celdecision pointcelEvaluate CEL expressions (dialect cel).
opadecision pointopaEvaluate Rego, embedded (dialect opa).
valkeysession storevalkeyPersist Session Taint labels across processes. CIBA can use the same server for approvals. See Session Taint.
vaultsecret providersecrets-vaultResolve secret: references from Vault KV v2. Not auto-registered: it needs an HttpTransport the host supplies.
quotapolicy pluginexperimental-quotaEnforce a per-principal token budget through Limitador. Experimental and excluded from builtins.
ratelimit/limitadorrate-limit pluginexperimental-ratelimitCount requests against in-process Limitador limits at ratelimit.pre_identity or ratelimit.post_identity, listed under rate_limits:, and deny with 429. Experimental and excluded from builtins. See Rate Limiting.

The default session store is in-process memory. It needs no feature and no kind, but labels in it do not survive a reload or reach a second replica.

CIBA approvals have their own correlation store, chosen by the plugin’s store: block: memory, or valkey to share them across replicas. Configuring global.session_store does not change it unless the block references that connection. The CIBA store: block is required; see Elicitation.

The three decision points are held to each other by a differential test suite. Given the same attributes and equivalent policy intent, they must agree across their shared boolean, integer, string, and string-set subset. Documented semantic differences are allowlisted; a new disagreement fails the build.

Not builtins

Two worked examples live in reference/plugins/ and are not bundled: a PII scanner (validator/pii-scan) and an audit logger (audit/logger). They are linted and tested here, and each manifest says why it is an example rather than a builtin: the scanner is plain regexes with no checksum validation, and the logger’s sink is stderr. Register them the way you would any host plugin.

Cargo features

# engine only, the default
praxis-policy = "0.7.0"

# every bundled extension
praxis-policy = { version = "0.7.0", features = ["builtins"] }

# a granular subset
praxis-policy = { version = "0.7.0", features = ["jwt", "cedar"] }
FeaturePulls in
builtinsall ten below: jwt, api-key, oauth, delegator-vault, elicitation-ciba, cedar, cel, opa, valkey, secrets-vault
jwtidentity/jwt, verified with AWS-LC
jwt-openssl-fipsidentity/jwt and DPoP, verified with system OpenSSL under the FIPS provider. Requires fips; cannot be combined with jwt. HMAC (HS256, HS384, HS512) and EdDSA are refused at config load
api-keyidentity/api-key
fipsOpenSSL FIPS SHA-256 for Policy’s shared hashing, used by the engine and API-key. Needs no identity builtin. Keyed content provenance is rejected because it requires HMAC. Select with default-features = false; other crypto-using builtins are reported and make the profile unsafe.
oauthdelegator/oauth
delegator-vaultdelegator/vault
elicitation-cibaelicitation/ciba
cedarthe cedar-direct decision point
celthe cel decision point
opathe opa decision point
valkeythe Valkey session store, and the redis and TLS stack it carries
secrets-vaultthe Vault KV v2 secret provider. Not auto-registered: it needs an HttpTransport the host supplies
experimental-quotathe opt-in Limitador-backed token quota plugin; excluded from builtins
experimental-ratelimitthe opt-in in-process Limitador request rate limit plugin for the rate-limit hooks; excluded from builtins
http-hypera default outbound HTTP transport, off by default

The default build is the engine alone, so a host that needs only the runtime and its own plugins compiles nothing extra.

Default builds use RustCrypto SHA-256. A FIPS build disables defaults and selects fips, optionally with api-key and jwt-openssl-fips; see FIPS for the supported selections, host setup and startup checks.

The HTTP transport

http-hyper is the odd one. PPE performs no outbound HTTP of its own: a host installs an HttpTransport and the plugins borrow it, so a process embedding PPE keeps one connection pool, one TLS trust store, and one egress path instead of two. A host with its own client injects it with PolicyEngine::set_http_transport. A host with none calls install_default_http_transport, which is what this feature provides. It is never wired automatically.

Install it before initialize(), since that is when a plugin first asks for it. The install is set-once: a second call is ignored and returns false, so a host that wires twice cannot swap the transport out from under plugins already holding it.

Two distinct mistakes fail that same initialize(), and the message names which one you made:

  • No transport installed. The plugin needs the http host service “but none is installed; the embedding host must install one before initializing the engine”. That is a wiring problem in the embedding program, not something the policy YAML can fix.
  • Transport installed, capability withheld. The plugin does not declare perform_http, and the error names the capability to add to its capabilities: list.

The engine keeps the two apart on purpose, so the message points at the file that needs the edit.

Referencing a builtin

A registered builtin is named by kind. Plugins are declared under plugins: with their hooks and capabilities, decision points under global.pdp:, and the session store under global.session_store:.

plugins:
  - name: jwt-user
    kind: identity/jwt
    hooks: [identity.resolve]
    capabilities: [perform_http]
    config:
      role: user
      credential:
        kind: header
        name: X-User-Token

global:
  pdp:
    - kind: opa
      policy_text: |
        package ppe
        default allow := false
  session_store:
    kind: valkey
    endpoint: localhost:6379

A plugin that fetches JWKS, exchanges a token, or dispatches a CIBA prompt must declare perform_http, or the engine refuses to start and names the plugin and the missing capability.

Credential location (identity/jwt)

Each identity/jwt instance reads its token from one wire location, named by the credential: block in the plugin’s config:. Three kinds are supported:

KindUse caseExample
headerBearer tokenAuthorization
cookieBrowser app__Host-jwt
query_paramWebSocket or SSEaccess_token

Query parameter credentials require the host to supply the raw query string in HttpExtension.query and grant the resolver read_query. Granting read_headers alone does not expose the raw query string to a plugin.

# Cookie-based JWT
plugins:
  - name: jwt-user
    kind: identity/jwt
    hooks: [identity.resolve]
    capabilities: [perform_http]
    config:
      role: user
      credential:
        kind: cookie
        name: __Host-jwt
      trusted_issuers:
        - issuer: "https://idp.example.com"
          audiences: ["my-api"]
          decoding_key:
            kind: jwks_url
            url: "https://idp.example.com/.well-known/jwks.json"
# Query-parameter JWT (WebSocket handshake)
plugins:
  - name: jwt-ws
    kind: identity/jwt
    hooks: [identity.resolve]
    capabilities: [perform_http, read_query]
    config:
      role: user
      credential:
        kind: query_param
        name: access_token
      trusted_issuers:
        - issuer: "https://idp.example.com"
          audiences: ["my-api"]
          decoding_key:
            kind: jwks_url
            url: "https://idp.example.com/.well-known/jwks.json"

Omitting both credential: and header: defaults to { kind: header, name: Authorization }. The legacy header: NAME setting still works but logs a deprecation warning when the resolver is built. Migrate it to credential: { kind: header, name: NAME } when updating the policy. Setting both fields on one resolver is a configuration error.

An issuer with DPoP enabled requires a header credential and the read_headers capability. A cookie or query parameter credential fails configuration loading when that issuer’s DPoP mode is optional or required.

Cookie and query-string values are parsed by PPE itself, not by the host’s HTTP framework, so the same request resolves the same credential regardless of which proxy sits in front of it. Duplicate cookie names or query-parameter names for the configured credential are rejected as ambiguous (auth.ambiguous_credential) rather than resolved by first-wins or last-wins.

Security note. A query-parameter token routinely appears in access logs, CDN logs, and browser history. PPE logs a one-time notice at startup when a resolver uses query_param so the operator can scrub raw query strings from infrastructure logging.

Next

  • Testing: test policy and plugin behavior through the runtime.
  • Configuration: declare builtins in a policy document.