GatewayInterceptor is a perimeter admission hook executed by LiopHybridGateway immediately after transport authentication and sliding-window rate limiting, prior to JSON-RPC request dispatch.
It provides an extension point for developers to attach arbitrary semantic filters, neural classifiers (such as TypeSafe Jev or ONNX runtimes), or deterministic rule engines without introducing external dependencies into the LIOP SDK core.
Perimeter admission hook position within LiopHybridGateway pipeline
Pipeline Ordering
The admission hook executes in strict sequential order:Configuration
The hook is configured via the optional fifth parameter ofLiopHybridGateway:
Options Reference
Interceptor Contract
The interceptor function adheres to this signature:Parameters
request: Readonly<McpRequest>
A frozen deep clone (Object.freeze(structuredClone(request))) of the incoming JSON-RPC envelope.
Top-level and nested property modifications performed inside the interceptor operate on an isolated clone, eliminating prototype pollution attacks against the gateway scope.
context: GatewayInterceptorContext
Return Value (GatewayAdmissionResult)
Usage Examples
Example 1: TypeSafe Jev (Probabilistic System One Classifier)
TypeSafe Jev performs fast semantic classification over tool arguments using typed primitives (noul, choice, score):
Example 2: Local ONNX Runtime (Zero-Egress ML Inference)
For edge deployments requiring zero network egress, local ONNX models evaluate request embeddings directly in-process:Example 3: Deterministic Rule Matcher (Zero Dependencies)
Example 4: Unconfigured Default Behavior
When no interceptor is passed toLiopHybridGateway, the perimeter admission stage is bypassed:
Network Topology & Placement Directives
Deploying interceptors within a distributed LIOP mesh requires adhering strictly to network boundary segregation per NIST SP 800-207 Zero-Trust Architecture:LIOP Interceptor Topology: Demarcation between Ingress Admission and Enclave Isolation
1. Perimeter Ingress Gateways (MANDATORY / RECOMMENDED)
- Target Node: Public entrypoints, DMZ ingress proxies, and service discovery seeds (e.g.
Nexus Gateway). - Hook Deployment:
GatewayInterceptoris deployed here to execute Layer 7 application firewalls, neural semantic classifiers (e.g. TypeSafe Jev), and IP/reputation filters. - Objective: Reject hostile probes (SQL injections, Path Traversal, prompt jailbreaks) in < 400 ms with
HTTP 403 Forbiddenand error code-32099before requests traverse the P2P mesh or consume enclave compute budgets.
2. Sovereign Data Enclaves (STRICTLY PROHIBITED)
- Target Node: Private data providers and Tier 1 enclaves (e.g.
The Bank,The Vault). - Policy:
GatewayInterceptorMUST NOT be configured on data enclave servers. - Technical Rationale:
- Prevention of False Positives on Code Payloads: In LIOP, clients send valid logic micro-modules (
@LIOP{...}...@END). Heuristic string-matching or generic WAF filters running inside enclaves inevitably misinterpret mathematical aggregations or analytical loops as code injection attacks. - True Zero-Trust Sandbox Isolation: Enclaves must never assume an upstream proxy neutralized threats. Instead, enclaves must rely entirely on The Shield (Guardian AST allowlist, WASI/V8 Sandbox with 25 poisoned globals, Taint IFC, and Egress PII Shield). Introducing an ingress admission hook on an enclave obscures the sandbox’s actual boundary and invalidates compliance audits.
- Prevention of False Positives on Code Payloads: In LIOP, clients send valid logic micro-modules (
3. Asymmetric Border Gateways (BLG)
- Target Node: Border LIO Gateway (
BLG) bridging Tier 2 (Consortium) into Tier 1 (Private Enclaves). - Policy: Evaluates clearance tiers (
clearanceTier: 4), mTLS client certificates, and the Tier 1 Swarm Key (tier1.psk). Routed logic payloads pass through directly to the target enclave without localGatewayInterceptorfiltering, allowing enclaves to evaluate code in-situ.
Security Model Verification
TheGatewayInterceptor operates solely as an admission gate at the DMZ boundary. It does not replace, alter, or weaken any of the six foundational LIOP security layers:
Related References
- Log & Audit Interceptors — Operational log stream and cryptographic audit ledger hooks.