prompt-shield-eval v1.1.0 — Hybrid LLM Prompt Injection Defense, ONNX INT8 Cascade & MCP Guardrail

Modular 3-export defense-in-depth LLM security engine in strict TypeScript 5.7: zero-dependency sub-millisecond Core (.), optional Layer 3.5 local 104.2 KB ONNX INT8 Semantic Cascade (./semantic), and drop-in MCP Middleware Guardrail (./mcp) targeting autonomous SRE agents (aegis-agent).

prompt-shield-eval v1.1.0 3-export hybrid defense architecture, 104.2 KB ONNX INT8 cascade, MCP guardrail, and verified evaluation metrics
v1.1.0 3-export modular defense stack (Core 0-deps, Layer 3.5 ONNX INT8 104.2 KB, MCP Middleware) and 3-job CI verified metrics.
01 / Modular 3-Export Architecture

Zero-bloat Core + selective ONNX INT8 + MCP Middleware

Built in strict TypeScript 5.7 (ESM) for Node.js 22/24, Vitest, ESLint 9 (--max-warnings=0), and 3-job parallel GitHub Actions CI, aligned with OWASP LLM Top 10 (LLM01, LLM06, LLM07) under the MIT License. Core runtime isolation (0 dependencies) is locked by both a static transitive import-graph check (scripts/verify-core-zero-deps.mjs) and an isolated clean-room npm pack tarball smoke test in CI.

  • Core (prompt-shield-eval — 0 runtime deps): Layer 1–5 deterministic pipeline (NFKC/Unicode Tag/homoglyph/multi-leet normalizer + depth-2 decode, O(N) linear HTML/Markdown anti-ReDoS scanners, 5-turn sliding window, bounded LRU+TTL TaintSessionStore, 16-ID bilingual EN/ID scorer PI-01–PI-14C, 128-bit cryptographic nonce trust boundary, and output canary/4-gram + strict integer/enum HITL tool gate).
  • Layer 3.5 Semantic Cascade (prompt-shield-eval/semantic — optional peer onnxruntime-node): Fast-path short-circuits obvious attacks at 0 ms ONNX overhead; only gray-zone inputs, subtle storytelling/academic framing (PI-06), and cross-lingual cues (PI-09: FR, ES, JA, DE, ID–EN–regional) escalate to a real 104.2 KB opset-19 INT8 ONNX mini-encoder (DynamicQuantizeLinear + MatMulInteger, SHA-256 verified against models/manifest.v1.json) with hard 25 ms AbortController timeout and explicit failMode.
  • MCP Middleware Guardrail (prompt-shield-eval/mcp — optional peer @modelcontextprotocol/sdk): Transport-agnostic ingress/egress interceptor (InMemory + subprocess stdio) with per-session taint tracking, aegis-agent (HYPERION CH06) 4-tool preset blocking compound indirect hijacks (-32001 TAINTED_CONTEXT_BLOCKED), rejecting float/invalid-enum schemas (-32602), verifying hitl1.* approval tokens, and bridging structured audit events.

Developed with AI coding assistance. All metrics below come directly from deterministic local suites and GitHub Actions CI Run #44668345769.

02 / Verified Metrics (v1.1.0 · 30/30 Vitest · 3-Job CI PASS)

Core, ONNX INT8 Cascade & MCP Guardrail evidence

  • Core Hot Path (26 cases: 20 attacks across 16/16 IDs + 6 hard negatives): 100.00% TPR, 0.00% FPR, 100.00% Exact Decision Match, 0 failures on PI-02 & PI-14B, warm p50 = 0.046 ms / p99 = 0.690 ms; 480+ deterministic fuzz seeds + 10 pathological 20–50 KB anti-ReDoS payloads completing in < 50 ms.
  • Hybrid Core + L3.5 ONNX INT8 (60 cases: 44 attacks + 16 hard negatives): 100.00% TPR, 0.00% FPR, 100.00% Exact Decision Match (60/60), selective escalation 37/60 (61.7%), hybrid warm p50 = 0.287 ms / p99 = 0.876 ms, ONNX INT8 inference p50 = 0.299 ms / p99 = 0.762 ms, plus 50,000-iteration cascade soak & 1,000 live ONNX inferences with 0 memory leak.
  • MCP Middleware Guardrail (aegis-agent, InMemory + Subprocess stdio): 20/20 (100%) compound indirect tool hijacks blocked (-32001), 20/20 legitimate HITL calls allowed (0 false blocks), 20/20 anti-float schema violations rejected (-32602), 121 structured audit events emitted, middleware overhead p50 = 0.217 ms / p99 = 0.752 ms (gate < 2.0 ms).
  • Parallel GitHub Actions CI (Run #44668345769): ci-core (29s, including static zero-deps & clean-room tarball test), ci-semantic-onnx (21s, SHA-256 model verification), and ci-mcp-adapter (25s) all PASS.
03 / Source Evidence & Scope

Review the implementation

  • package.json (3 subpath exports, 0 runtime deps) · .github/workflows/ci.yml (3-job CI) · scripts/verify-core-zero-deps.mjs
  • src/normalizer.ts · src/hardened-detector.ts · src/trust-boundary.ts · src/output-tool-gate.ts · src/session-taint.ts
  • src/semantic/cascade.ts · src/semantic/onnx-provider.ts · src/semantic/tokenizer.ts · models/semantic-mini-encoder.int8.onnx (104.2 KB) · models/manifest.v1.json
  • src/mcp/middleware.ts · src/mcp/aegis-preset.ts · src/mcp/aegis-stdio-server.ts · test/*.test.ts (5 suites, 30/30 PASS)

Source audit: 20 November 2026. Commit 9c1aa84 (tag v1.1.0) · github.com/vanovri/prompt-shield-eval · Source evidence index.

Evidence boundary: The evaluation suites verify deterministic rule accuracy, zero-FPR behavior on synthetic hard negatives, local INT8 ONNX cascade latency, fuzz/anti-ReDoS bounds, and MCP taint isolation on synthetic in-memory canaries and mock tools; no guardrail guarantees immunity against novel adaptive LLM attacks without layered model- and infrastructure-level controls.

All projects

Navigate with arrow keys. Enter opens a result. Escape closes search.