@@ -66,6 +66,31 @@ matchers; generic JSON-RPC rules match only the method.
6666JSON-RPC responses and server-to-client MCP messages on response or SSE streams
6767are relayed but are not currently parsed for policy enforcement.
6868
69+ For admitted HTTP requests, the proxy can run an ordered supervisor middleware
70+ chain after L7 policy evaluation and before credential injection. Destination
71+ host selectors choose the chain independently of the network rule that admitted
72+ the request. Policy-local map keys identify configs, while built-in names or
73+ operator-owned registration names identify implementations.
74+
75+ Built-ins run in-process; operator services use the same bounded gRPC contract.
76+ ` openshell-policy ` validates policy-owned structure, and the active middleware
77+ registry validates implementation-owned config. The generic registry and chain
78+ runner live in ` openshell-supervisor-middleware ` ; first-party implementations
79+ live in ` openshell-supervisor-middleware-builtins ` .
80+
81+ The supervisor installs policy and middleware registry changes as one runtime
82+ generation and preserves the last-known-good generation if preparation fails.
83+ Policy-only updates reuse the connected registry, so an external middleware
84+ outage cannot block unrelated policy changes.
85+
86+ Middleware cannot observe injected credentials or mutate supervisor-owned
87+ credential, routing, or framing headers. Body transformations are re-evaluated
88+ against body-aware L7 policy before later stages or the upstream can observe
89+ them. Requests, results, chain length, execution time, and diagnostics are
90+ bounded; external free-form diagnostic text is not exposed in responses or
91+ security logs. See [ Supervisor Middleware] ( ../docs/extensibility/supervisor-middleware.mdx )
92+ for configuration and protocol details.
93+
6994` https://inference.local ` is special. It bypasses OPA network policy and is
7095handled by the inference interception path:
7196
@@ -206,8 +231,10 @@ engine with a gateway policy revision.
206231## Failure Behavior
207232
208233- If gateway config polling fails, the sandbox keeps its last-known-good policy.
209- - If a live policy update is invalid, the supervisor rejects it and keeps the
210- current policy.
234+ - If a live policy or middleware-registry update is invalid, the supervisor
235+ rejects the combined update and keeps the current runtime pair.
236+ - If an operator-run middleware call fails, the selected config's ` on_error `
237+ behavior decides whether to deny the request or continue without that stage.
211238- Existing raw byte streams are connection scoped. Dynamic policy changes apply
212239 to new connections or the next parsed HTTP request where the proxy can safely
213240 re-evaluate.
0 commit comments