Security

How TrustGuard's trustrt Runtime and Apache APISIX Harden LLM Gateways Against Prompt & Output Leaks

On December 3, 2026, NeuralTrust published 3.0–4.8 ms L4 GPU guardrail benchmarks for its custom C++/CUDA runtime (trustrt 0.3.3) alongside a new ai-neuraltrust-guard plugin for Apache APISIX 3.18+ ai-proxy routes. Paired with Quarkslab's November 26 format-coercion findings and ACSC guidance, this architectural review examines input/output enforcement, fail-open policy traps, and the plugin's MCP tool-call blind spot.

By 0xScorPionSon

8 min read

How TrustGuard's trustrt Runtime and Apache APISIX Harden LLM Gateways Against Prompt & Output Leaks

TrustGuard trustrt 0.3.3 and Apache APISIX ai-proxy LLM guardrail architecture infographic

Executive Summary

  • Core Defensive Capability: On December 3, 2026, NeuralTrust released benchmark telemetry for TrustGuard running on trustrt 0.3.3—a custom C++/CUDA guardrail inference runtime replacing PyTorch on GPU—alongside an ai-neuraltrust-guard plugin for Apache APISIX 3.18+ ai-proxy and ai-proxy-multi routes (NeuralTrust Benchmark, NeuralTrust APISIX Integration).
  • Target Architecture & Verified Latency: On one NVIDIA L4 GPU with every token scored and caching disabled, TrustGuard's seven detection models answered 128-token prompts in 3.0 to 4.8 ms (toxicity at 3.0 ms, prompt jailbreak at 3.5 ms) and up to 860 requests/sec, achieving 2.30x median throughput over NeuralTrust's previous PyTorch-based firewall (1.15x on CPU) (NeuralTrust Benchmark, NeuralTrust Resources).
  • Why External Gateway Guardrails Matter: Security researchers at Quarkslab demonstrated on November 26, 2026 that system-prompt guardrails read the question rather than the answer—allowing format-coercion attacks (requesting raw JSON) to leak tool calls, retrieved documents, and safety-classifier outputs—concluding that "filtering the output is the only fix that holds" (Quarkslab).
  • Primary Architectural Trade-Off: Attaching ai-neuraltrust-guard to existing Apache APISIX routes enforces Monitor, Block, and Redact (Transform) controls on prompts and completions without changing application code, but does not evaluate MCP tool calls and relies on per-request evaluation without native APISIX session memory (NeuralTrust APISIX Integration, NeuralTrust vs. APISIX).

Trust Model & Architecture

Moving Enforcement Outside the Model

Both the Australian Cyber Security Centre (ACSC, 2026) and independent red-team evaluations warn against relying solely on safeguards baked into model weights or system prompts (NeuralTrust Amazon Ergo Brief, Quarkslab). Placing a dedicated guardrail engine at the API gateway establishes an external trust boundary that inspects both ingress prompts and egress completions before responses reach clients.

In NeuralTrust's December 3, 2026 Apache APISIX integration (built by Lead AI Security Researcher Alessandro Pignati), three Lua files (ai-neuraltrust-guard.lua, schema.lua, and client.lua) are loaded via extra_lua_path alongside ai-proxy or ai-proxy-multi to route traffic to OpenAI, Anthropic, or Amazon Bedrock without modifying upstream or downstream applications (NeuralTrust APISIX Integration). Because APISIX loads external plugins from apisix.extra_lua_path (mounted from a local directory in Docker apache/apisix:3.21.0-debian or via a Kubernetes ConfigMap), teams do not need to recompile APISIX itself.

flowchart LR
    Client["Client / App"] -->|"1. LLM Request"| APISIX["Apache APISIX 3.18+ (ai-proxy)"]
    APISIX -->|"2. Input Prompt Check"| TG["TrustGuard (trustrt 0.3.3 CUDA)"]
    TG -->|"Block / Allow / Redact"| APISIX
    APISIX -->|"3. Forward Approved Prompt"| LLM["OpenAI / Anthropic / Bedrock"]
    LLM -->|"4. Raw Completion"| APISIX
    APISIX -->|"5. Output & DLP Inspection"| TG
    TG -->|"Redact PII / Block Leak"| Client

Architectural Boundaries: APISIX Plugin vs. Native AI Gateway

Architectural Capability Apache APISIX + ai-neuraltrust-guard Native TrustGate / TrustGuard Gateway Source
Deployment Model Lua plugin on existing APISIX 3.18+ (3.21.0 Docker) Purpose-built AI gateway (trustrt 0.3.3) APISIX Integration, Comparison
Prompt & Completion Eval Evaluates prompts and (with direction) completions: Monitor, Block, Redact Native inline inspection across full conversation APISIX Integration
Session Memory Per-request inspection only; multi-turn drift outside APISIX scope Built-in session memory across multi-turn conversations NeuralTrust vs. APISIX
MCP Tool-Call Inspection Not evaluated by this plugin Native catalog (200+ MCP servers) + Gemini Enterprise tools/call (~30 ms) APISIX Integration, Gemini MCP

Unlike APISIX's built-in regex Prompt Guard plugin—which inspects single requests using static allow/deny patterns and lacks session context—adding TrustGuard routes prompts and completions to dedicated neural detectors for indirect prompt injection, toxicity, custom moderation, and PII data loss prevention (NeuralTrust vs. APISIX, NeuralTrust APISIX Integration).

What Researchers & Analysts Say

Evaluating December 2026 guardrail architectures requires separating vendor-measured runtime speedups from red-team findings on how guardrails fail in production:

  1. Quarkslab on Format Coercion & Output Filtering (Nov 26, 2026): In a red-team engagement against a LangChain support assistant, Quarkslab's Ayoub El Yadini found that a system-prompt guardrail blocked direct questions about internal instructions, yet requesting raw JSON instead of prose coerced the model into dumping tool calls, arguments, retrieved documents with metadata, and safety-classifier outputs. Quarkslab concluded the underlying framework was not at fault—rather, "a guardrail written in the system prompt reads the question, not the answer," making output filtering essential (Quarkslab).
  2. Dark Reading on Fragmented Component Policies (Oct 19, 2026): Dark Reading noted that relying on built-in model guardrails is brittle because refusal behavior can weaken without retraining and safety-stripped open models circulate publicly, while component-by-component policies miss emergent risks when multiple approved tools interact (Dark Reading).
  3. NeuralTrust Benchmark Methodology & Caveats (Dec 3, 2026): NeuralTrust engineer Martí Jordà measured 3.0 to 4.8 ms median latency per 128-token prompt and 860 req/sec on one NVIDIA L4 GPU (2.30x L4 GPU / 1.15x CPU speedup over the prior firewall) with every token scored and caching turned off (NeuralTrust Benchmark). However, NeuralTrust explicitly disclosed that both "Firewall performance benchmark, December 2026" and "Old firewall against trustrt" are internal, non-public benchmarks—so teams should run pilot latency tests on their own 512–4,000 token payloads before sizing GPU clusters.
  4. APISIX Operational Caveats (Dec 3, 2026): NeuralTrust's integration guide warns of two silent misconfiguration traps: first, a TrustGuard collector with no attached policy returns allow and inspects nothing with no warning; second, omitting prometheus from APISIX's plugins: list causes ai-proxy to fail to load and every route to return 404 (NeuralTrust APISIX Integration).

Confidence note: Because NeuralTrust's trustrt 0.3.3 benchmark datasets are internal and not publicly reproducible as of December 3, 2026, throughput and millisecond figures carry vendor-reported confidence until independently replicated.

Hardening & Implementation Blueprint

Eliminating Fail-Open Traps and Credential Sprawl

When deploying gateway-level guardrails in production across the five-step setup (policy creation, plugin installation, collector key injection, route configuration, and verification testing):

  • Start in Observe, Validate Activity, Then Enforce: Always attach an explicit policy (covering Prompt Guard Block on Input, Toxicity Detection and Custom Moderation Block on Output, and Transform for DLP PII such as email, card, and IBAN) before switching from Observe to Enforce. A blocked request never reaches the upstream model in Enforce mode, while a Transform verdict rewrites sensitive fields inline (NeuralTrust APISIX Integration).
  • Never Hardcode Collector Keys in Routes: Store NEURALTRUST_API_KEY as an environment variable or $secret:// reference (HashiCorp Vault, AWS, or GCP Secrets Manager) rather than pasting literal keys into APISIX route definitions (NeuralTrust APISIX Integration).
  • Account for Timeout & Failure Modes: Set an explicit inspection timeout (e.g., 5000 ms) and decide whether uninspected traffic should skip, warn, or error based on your data-classification tier (NeuralTrust APISIX Integration).
  • Bridge the MCP Gap Separately: Because ai-neuraltrust-guard on APISIX does not inspect MCP tool calls, route MCP tools/call traffic through a dedicated MCP-aware gateway or host hook if agents invoke external tools (NeuralTrust APISIX Integration, NeuralTrust Gemini MCP).

Safe Configuration: Hardened Apache APISIX + TrustGuard Setup

The YAML configuration and route plugin JSON below follow NeuralTrust's December 3, 2026 deployment pattern, preserving prometheus alongside ai-proxy and ai-neuraltrust-guard and referencing the collector key via environment injection:

apisix:
  extra_lua_path: "/opt/neuraltrust/?.lua"

plugins:
  - prometheus
  - ai-proxy
  - ai-proxy-multi
  - ai-neuraltrust-guard
{
  "ai-neuraltrust-guard": {
    "api_key": "$env://NEURALTRUST_API_KEY",
    "timeout": 5000,
    "on_error": "error"
  }
}

4-Step Production Rollout Checklist

  1. Create & Bind Policy Before Routing Traffic: Configure Input (Prompt Guard), Output (Toxicity / Custom Moderation), and DLP (Transform) rules in TrustGuard and bind the APISIX collector so no route defaults to silent allow (NeuralTrust APISIX Integration).
  2. Verify Admin Schema & prometheus Dependency: Mount the three Lua plugin files under /opt/neuraltrust/apisix/plugins, include prometheus in conf/config.yaml, and query /apisix/admin/plugins/ai-neuraltrust-guard to confirm a valid JSON schema response (NeuralTrust APISIX Integration).
  3. Test Output Filtering Against Format Coercion: Red-team your routes with raw-JSON and structured-output coercion prompts to confirm egress inspection blocks or redacts leaked tool arguments and metadata (Quarkslab).
  4. Benchmark Tail Latency on Target Token Lengths: Run a pilot in Observe mode across representative 512–4,000 token completions to measure real-world p95 overhead before enabling Enforce (NeuralTrust Benchmark, NeuralTrust APISIX Integration).

FAQ

1. What is trustrt 0.3.3 in NeuralTrust's TrustGuard firewall?

trustrt is a custom guardrail inference runtime written from scratch in C++ with custom CUDA kernels, replacing PyTorch on GPU. In NeuralTrust's December 3, 2026 internal benchmark, it delivered 2.30x median requests per second on an NVIDIA L4 GPU (1.15x on CPU) and 3.0–4.8 ms median latency for 128-token prompts.

2. Does the Apache APISIX ai-neuraltrust-guard plugin inspect MCP tool calls?

No. NeuralTrust's December 3, 2026 integration documentation explicitly notes that MCP tool calls are not evaluated by this APISIX plugin; organizations needing tools/call inspection require an MCP-aware integration or gateway.

3. Why did Quarkslab's LangChain test bypass system-prompt guardrails?

Quarkslab found that system-prompt guardrails evaluate the user's question rather than the model's generated answer. Coercing the assistant to reply in raw JSON caused it to output internal tool calls, retrieved documents, and safety-classifier state, demonstrating why gateway-level output filtering is necessary.

4. What happens if a TrustGuard collector has no attached policy in APISIX?

According to NeuralTrust's APISIX documentation, a collector with no attached policy returns allow and inspects nothing without emitting a warning. Always create and bind a policy in Observe mode before routing traffic.

5. Why does ai-proxy return 404 when adding ai-neuraltrust-guard to config.yaml?

Because defining plugins: in conf/config.yaml overrides APISIX's default plugin list, omitting prometheus prevents ai-proxy from loading and causes every AI route to return 404. Copy the default plugins: list and keep prometheus next to ai-proxy.

Sources

  1. NeuralTrust Benchmark Report — TrustGuard Firewall Guardrail Benchmark (https://neuraltrust.ai/blog/trustguard-guardrail-performance-benchmark), published December 3, 2026.
  2. NeuralTrust Integration Guide — TrustGuard Now Works with Apache APISIX (https://neuraltrust.ai/blog/apache-apisix-trustguard-integration), updated December 3, 2026.
  3. NeuralTrust Architecture Comparison — NeuralTrust vs Apache APISIX: AI Gateway (https://neuraltrust.ai/blog/neuraltrust-vs-apache-apisix), published July 16, 2026.
  4. NeuralTrust MCP Integration — TrustGuard Now Works With Gemini Enterprise (https://neuraltrust.ai/blog/gemini-enterprise-mcp-security), published December 3, 2026.
  5. Quarkslab Red-Team Analysis — I'll Have a Raw JSON, Please: Leaking a LangChain Assistant Through Format Coercion (https://blog.quarkslab.com/), published November 26, 2026.
  6. Dark Reading — The hidden risks of fragmented AI security (https://www.darkreading.com/threat-intelligence/the-hidden-risks-of-fragmented-ai-security), published October 19, 2026.

More on Security

Tell us what is not working

A thirty-minute call, no deck and no obligation. You will leave with a straight answer about whether this is worth building - including if that answer is no.

Start a project

Direct line

hello@codebumble.net
Dhaka, Bangladesh  :   local timeCalls in English or Bangla