Transparent Proxy
The transparent proxy places OpenProdkt governance in front of existing HTTP and gRPC services. Each protected request is evaluated by the control plane before it reaches the upstream service, so governance applies without changes to the services themselves.
Components
- Envoy receives client traffic. For each protected request, it asks the authorization adapter for a decision and forwards the request upstream only when the decision allows it.
- Authorization adapter (
openprodkt-ext-authz) implements the Envoyext_authzgRPC interface. It maps each request to a configured protected asset and operation, then asks the control plane to evaluate it. - Control plane evaluates the decision against policy and the account's entitlements.
An unknown or inaccessible explicit asset ID fails closed. For ordinary HTTP and
gRPC routes, the authorization adapter preserves the PDP's HTTP 404 and
asset_not_found code; the upstream is not called. On MCP routes, this becomes
an error tool result with reason asset_not_found, not a transport-level 404.
Unknown derived asset keys retain the existing asset_not_registered ALLOW
behavior, so register assets and attach policies before relying on governance.
Requirements
- The
proxy.enabledentitlement. Without it,/v1/proxy/evaluatereturns403and every proxied request is blocked. See Licensing & Distribution. - Envoy 1.32 or later.
- Network access from the adapter to the control plane API, and from Envoy to the adapter over gRPC.
Authorization adapter configuration
The adapter reads its configuration from environment variables. It exits with an error at startup if a required variable is missing or the route file is invalid.
| Variable | Required | Default | Purpose |
|---|---|---|---|
OPK_AUTHZ_PDP_BASE_URL | Yes | None | Base URL of the control plane API. |
OPK_AUTHZ_ROUTES_FILE | Yes | None | Path to the route configuration JSON file. |
OPK_AUTHZ_LISTEN_ADDRESS | No | :9191 | gRPC listen address for Envoy ext_authz. |
OPK_AUTHZ_PDP_TIMEOUT | No | 2s | Timeout for each control plane decision call, as a Go duration such as 500ms or 2s. |
The adapter forwards each request's authorization header to the control plane, so decisions are made for the calling identity. It does not use a shared API key.
Health check
The adapter binary includes a health check subcommand:
openprodkt-ext-authz healthcheck [address]
The command exits with 0 when the gRPC listener accepts TCP connections. The default address is 127.0.0.1:9191. The check confirms that the listener is up. It does not verify control plane connectivity.
Route configuration
The route file is trusted deployment configuration. It declares which HTTP and gRPC operations are protected and which asset each one belongs to. The file is a JSON object with http and grpc arrays. Unknown fields are rejected.
{
"http": [
{
"route_id": "refunds-create-http",
"host": "payments.example.com",
"method": "POST",
"path": "/v1/refunds",
"operation_id_header": "Idempotency-Key",
"asset_identity": {
"application": "payments",
"service": "refunds",
"environment": "production"
},
"header_allowlist": ["content-type"]
}
],
"grpc": [
{
"route_id": "refunds-create-grpc",
"full_method": "/example.refund.v1.RefundService/CreateRefund",
"rpc_type": "unary",
"operation_id_header": "idempotency-key",
"asset_identity": {
"application": "payments",
"service": "refunds",
"environment": "production"
}
}
]
}
HTTP route fields
| Field | Description |
|---|---|
route_id | Unique identifier for the route. Must be unique across HTTP and gRPC routes. |
host | Host name the route applies to. Normalized before matching. |
method | HTTP method, uppercase. |
path | Exact path. Must start with / and must not contain ? or #. |
operation_id_header | Request header that carries the operation ID, for example Idempotency-Key. |
asset_identity | Protected asset: application, service, and environment. |
header_allowlist | Optional. Additional request headers forwarded to the control plane. |
gRPC route fields
| Field | Description |
|---|---|
route_id | Unique identifier for the route. |
full_method | Canonical gRPC method, for example /package.Service/Method. |
rpc_type | One of unary, client_streaming, server_streaming, or bidirectional_streaming. |
operation_id_header | Request metadata key that carries the operation ID. |
asset_identity | Protected asset, as for HTTP routes. |
MCP route fields
An MCP endpoint is declared in the http array with protocol: "mcp". The route matches any method on the exact host and path, so method and the HTTP-only fields must be omitted. Governance is configured per tool, using the same rules as the stdio wrapper.
{
"route_id": "support-tools-mcp",
"host": "mcp.example.com",
"path": "/mcp",
"protocol": "mcp",
"organization": "acme",
"server": "refunds",
"application": "support-agent",
"environment": "production",
"tools": {
"lookup_order": { "asset_id": "ast_..." },
"create_refund": {
"asset_id": "ast_...",
"arguments": { "amount": "amount_cents" }
}
}
}
| Field | Description |
|---|---|
route_id | Unique identifier for the route. |
host | Host name the route applies to. |
path | Exact path of the MCP endpoint. |
protocol | Must be mcp. |
organization, server, application, environment | Identity of the MCP server, as in the stdio wrapper configuration. |
tools | Map of tool name to asset_id and optional arguments, as in the stdio wrapper configuration. |
Replace ast_... with the registered asset ID for each tool.
Rules
- Each host, method, and path combination, and each gRPC
full_method, can be mapped only once. An MCP route is mapped by host and path. - The asset identity comes only from this file. Requests cannot supply or override it.
- The operation ID value must be 1 to 128 characters from letters, digits,
.,_,:, and-. MCP routes take the operation ID from thetools/callbody, so they do not use an operation ID header. - A request that matches no configured route is denied with
403. A request without a valid operation ID is denied with400. - For MCP routes, see MCP over HTTP through Envoy for how each request type is handled.
Envoy configuration
Envoy must enforce the following settings for the proxy to be supported.
- Fail closed. Set
failure_mode_allow: falseon theext_authzfilter. If the adapter cannot be reached, Envoy returns503and the request is not forwarded. For MCP routes, a control plane outage is returned as a JSON-RPC result withreason: pdp_unavailable, not as503. - Timeout above the decision budget. Set the
ext_authztimeout above the adapter'sOPK_AUTHZ_PDP_TIMEOUT, which defaults to2s. If Envoy gives up first, the adapter's answer is lost. The reference configuration uses5s. - Request bodies only where needed. Enable
with_request_bodyonly on MCP routes and on routes that bind the request payload, with a boundedmax_request_bytesandallow_partial_message: false. Other routes must not send bodies to the adapter. Stream messages are never sent to the adapter, and the proxy does not store request bodies. - Header allowlist. Send only the headers the adapter needs, such as
authorization,content-type,mcp-session-id, the operation ID header, andtraceparentif you want trace correlation. The adapter only reads an inboundtraceparent; it never creates or injects trace headers. See Trace and execution correlation. - Strip governance headers. Remove inbound
x-openprodkt-*headers in both directions, so clients cannot spoof governance headers. - Path normalization. Enable
normalize_pathandmerge_slashes, and reject escaped slashes, so route matching uses the same path the upstream receives. - Timeouts. Use a 30 second route timeout for REST routes and no route timeout for gRPC streams and MCP endpoints, because MCP responses can be long-lived server-sent event streams.
The following fragment shows the ext_authz filter and the adapter cluster. Replace the placeholder names with values for your environment. Add one cluster per upstream service.
http_filters:
- name: envoy.filters.http.ext_authz
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
transport_api_version: V3
failure_mode_allow: false
status_on_error:
code: ServiceUnavailable
grpc_service:
envoy_grpc:
cluster_name: governance_ext_authz
timeout: 5s
allowed_headers:
patterns:
- exact: authorization
- exact: content-type
- exact: idempotency-key
- exact: mcp-session-id
- exact: traceparent
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
clusters:
- name: governance_ext_authz
type: STRICT_DNS
connect_timeout: 1s
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http2_protocol_options: {}
load_assignment:
cluster_name: governance_ext_authz
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address: { address: openprodkt-ext-authz, port_value: 9191 }
Limits and timeouts
| Item | Value | Notes |
|---|---|---|
OPK_AUTHZ_PDP_TIMEOUT | 2 seconds default | Decision call timeout for HTTP and gRPC routes. On timeout the request is blocked with 503 pdp_unavailable; the upstream is not called. |
| MCP route decision timeout | 5 seconds, fixed | Not affected by OPK_AUTHZ_PDP_TIMEOUT. |
| Request body buffer | 1 MiB | Used for payload binding and MCP tools/call. An MCP body over 1 MiB returns 413 payload_too_large. A payload-bound HTTP route with a larger body is rejected as malformed. |
| Approval challenge | Retry-After 30 s, grant window 120 s | Fixed. See Approvals. |
MCP denials and protocol errors on the Envoy path are HTTP 200 JSON-RPC responses. The Envoy MCP path cannot report operation outcomes, so its audit trail records decisions only; see Audit. All limits are listed in Limits and Configuration.
Outcome coverage
The Envoy adapter is a decision point only. It authorizes a request before Envoy forwards it and cannot see the upstream response, so it does not record outcomes. Recording outcomes from Envoy (an ext_proc response-phase observer or similar) is not available, and the adapter adds no filter or header to the request path for it.
- What the trail shows. For an allowed HTTP, gRPC or MCP request through Envoy, the audit trail shows the decision. It shows an outcome only if your own application reports one with
POST /v1/proxy/outcomes(for example with the SDK one-shot outcome guard), using the same principal that received theallowand theoperation_idof the decision. - MCP routes declare it. Decisions on Envoy MCP routes carry
outcome_reporting: none, which marks that no reporter is expected. Without a report, filtering the audit byoperation_idshows the read-timeoperation.outcome.not_reportedrow, and, with outcome deadline monitoring on, a storedexecution.outcome.not_reportableevent. See Coverage events. - HTTP and gRPC routes do not declare it. With monitoring on, an allowed HTTP or gRPC request for which nobody reports an outcome gets an
execution.outcome.missingevent after the deadline. That event means no report arrived, not that the call failed or did not run. - No change to the request. Neither the absence of an outcome nor a coverage event blocks, replays or retries a request, or changes authorization, approval state or billing.
Deployment
The proxy is delivered as a container image. Run the adapter and Envoy as separate containers on a private network. Envoy is the only component that receives client traffic. Do not publish the adapter's gRPC port outside that network.
The v0.8.0 adapter is publicly available on GitHub Container Registry. Anonymous access to this image has been verified; a registry login is not required.
docker pull ghcr.io/openprodkt/pep-envoy:v0.8.0
For a reproducible deployment, pin the verified digest instead of a mutable tag:
docker pull ghcr.io/openprodkt/pep-envoy@sha256:00b8ef6c5f9818d44b2bf4bc1a80f8b358d1c1a6b364f1bd14b742c557cf76fd
This image contains the authorization adapter, not Envoy itself. Use matching control-plane and SDK versions and follow the coordinated upgrade and rollback guidance. Downloading an image does not upgrade a running deployment.
Verify the setup
After you start the components, check the following:
- The adapter health check succeeds:
openprodkt-ext-authz healthcheck. - A request to a protected host and path that is not in the route file is denied with
403. - A request to a configured route without the operation ID header is denied with
400. - A request to a configured route with a valid operation ID is evaluated by the control plane and recorded in the decision history.
- For an MCP route, a
POSTwithout aBearertoken is refused with401. With a token, atools/callto a tool that a policy denies returns a JSON-RPC result withisError: trueanddecision: deny, and the MCP server does not receive the call.
Denied and blocked requests
- Denied requests receive an immediate response. The proxy does not hold a request while approval is pending.
- Invalid evaluation context returns
400withcode: invalid_contexton generic HTTP/gRPC authorization. It is not charged and never reaches the upstream. MCP routes instead return a JSON-RPC tool result withisError: true,reason: invalid_context, and the operation ID; malformed MCP requests remain JSON-RPC errors. - A request that is blocked for approval can be resubmitted after approval. See Transparent proxy retry and Proxy challenge.
- If Envoy cannot reach the adapter within the timeout, the request fails with
503. For MCP routes, a control plane outage is returned as a JSON-RPC result, not as503. See MCP over HTTP through Envoy.
For the proxy endpoint, see API Reference.