You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: As a user, I want to protect LLM traffic with NeuralTrust TrustGuard, so that prompt injection, jailbreaks and unsafe content are blocked at the gateway #14308
I'd like to propose a new AI security plugin, ai-neuraltrust-guard, that integrates NeuralTrust TrustGuard (an AI firewall) with APISIX's AI gateway.
It follows the same design as ai-lakera-guard (#13291, #13570) and builds on the ai-protocols layer, so it works with any provider supported by ai-proxy / ai-proxy-multi.
How it works
access phase: extracts the conversation via ai-protocols (get_messages, keeping
system/user/assistant roles) and calls POST /v1/evaluate on TrustGuard.
lua_body_filter phase (optional, direction: output|both): evaluates the LLM response,
including streaming responses, reusing the Lakera-style buffering approach.
If TrustGuard returns a blocking verdict (block_on, default ["block", "ask"]), the request
is denied with a provider-compatible response built by ai-protocols (build_deny_response).
Proposed schema (main fields)
api_key (required, stored encrypted via encrypt_fields, supports $secret:// / $env://)
deny_code, request_failure_message, response_failure_message, reveal_failure_categories, session_id_header (same semantics as ai-lakera-guard)
Priority 1027, next to the other AI guard plugins.
Scope
Test::Nginx tests run against a local mock of the TrustGuard /v1/evaluate API, built
from real API responses, so CI needs no credentials or external calls.
I work at NeuralTrust, and I've also validated the plugin end to end against the
production TrustGuard API (APISIX 3.21: benign prompt allowed, jailbreak blocked).
The PR includes an optional e2e script that maintainers can run with their own key.
English docs in docs/en/latest/plugins/ai-neuraltrust-guard.md.
Implementation: #14309 (draft). Happy to split it into smaller PRs (input first, then
output/streaming) if the maintainers prefer. Feedback on naming, priority and defaults
is very welcome.
I've already got a working implementation and tested it end to end against the real
TrustGuard API with APISIX 3.21 (benign prompt passes, jailbreak is blocked). I'm happy to
open the PR, or split it into smaller PRs (input first, then output/streaming), whichever
the maintainers prefer. Feedback on naming, priority and defaults is very welcome.
Activity