Knowledge does not execute the business action. It returns a signed verdict that a downstream Policy Enforcement Point (PEP) verifies before executing the underlying call. This page explains the model.
The envelope
Every /check and /resolve response includes a signed_verdict field : a compact JWS (JSON Web Signature) produced with ECDSA P-256 (ES256). It has three parts joined by dots :
<protected-header-b64>.<claims-b64>.<signature-b64>
Protected header :
{
"alg": "ES256",
"typ": "governed+jws",
"kid": "tnt-acme:2026-01"
}
The kid identifies the tenant + signing epoch. It resolves to a public key at the tenant's JWKS endpoint.
Claims (the payload) :
{
"iss": "https://knowledge.asplenz.com/tnt-acme",
"iat": 1737849600,
"exp": 1737849660,
"authorization": {
"actor": "agn-rm-copilot",
"action": "refund.execute",
"resource": "TX-456",
"parameters": { "amount_eur": 40 }
},
"decision": {
"verdict": "allowed",
"cited_rule_version_ids": ["rv-abc", "rv-def"],
"dominating_rule_id": "rul-refund-under-100"
},
"context_hash": "sha256:9f2c...",
"consultation_id": "cns-abc123",
"on_behalf_of": "hum-marie",
"on_behalf_of_authenticated": false
}
The signature covers the header + claims. Any modification invalidates the signature.
The PEP contract
A PEP is any component that wraps a business API and verifies verdicts before executing. Concrete examples in this codebase :
@governed_tooldecorator inknowledge-runtime(Python).- MCP proxy in
knowledge-mcp-proxy(transparent proxy in front of an MCP server). - Custom code you write in any language.
Every PEP performs the same six checks on receipt :
- Signature verification using the JWKS public key.
expcheck - reject expired verdicts (nbfif present).- Actor binding - the operation's actor matches
authorization.actor(from Knowledge's authentication, not from the caller's payload). - Action binding - the tool's declared
actionmatches. - Resource binding - the operation's
resourcematches. - Parameter bindings - for each declared bind field, the operation's value matches the signed value (or falls within the signed range).
If any check fails, the PEP refuses with a typed error (signature_invalid, expired, binding_mismatch, ...) and never invokes the underlying business API.
Why this catches replay + injection
- Same call, different amount :
parameters.amount_eurbinding does not match. Refused. - Same call, different resource :
resourcebinding does not match. Refused. - Same call, different actor via body injection : Knowledge's
actorin the claims comes from Knowledge's own authentication ; a malicious body cannot force a different actor. - Same call, an hour later :
expin the past. Refused.
What the PEP does NOT guarantee
- Replay within TTL. If the same verdict is submitted twice within its TTL for the same operation, the signature is valid both times. For exactly-once operations, add a spent-verdicts store (a set of
{iss, consultation_id}you've already burned). - Alternative reach paths. If your network / IAM lets the agent reach the business API directly without going through the PEP, no signed verdict helps. The PEP owns the tool boundary ; it does not police the whole network.
- Trustworthiness of
on_behalf_of. Theon_behalf_of_authenticatedfield tells you whether the delegation is backed by identity binding (true) or is caller-asserted metadata (false). The PEP should tighten authorisation whenfalse.
TTL
Default 60 seconds. Configurable :
- Per tenant :
verdict_ttl_secondsin tenant config. - Per call :
X-Verdict-TTL: 30header on the/checkor/resolverequest.
Short TTLs (a few seconds) reduce replay window ; long TTLs (minutes) accommodate slow business APIs. Pick per operation.
Key management
Signing keys live at ${DATA_DIR}/keys/verdict-signing.json (single deployment-wide key today, per-tenant supported by the resolver stub). Rotation flow at Rotate signing keys.
JWKS endpoint (per tenant) :
GET /knowledge/v1/tenants/{slug}/jwks
Cached client-side by knowledge-runtime for 5 minutes by default.
Related
- Enforcement product page - the story-level view.
- Verdicts and decisions - what's inside the decision block.
- Four-actor trust model - who signs, who verifies, what each edge guarantees.
- /v1/jwks - the JWKS endpoint contract.
knowledge-runtimePython - the reference PEP.- MCP proxy - transparent PEP for MCP servers.
