llm-trust-guard
35 security guards for LLM-powered and agentic AI applications. Zero dependencies. Covers OWASP Top 10 for LLMs 2025, OWASP Agentic AI 2026, and MCP Security.
Power your agent
คำสั่งของผู้เผยแพร่เอง ไม่ใช่เอนด์พอยต์ของ PlugMCP
Host a copy with our keys and logs.
npx -y [email protected]Claude Code ไม่มีลิงก์ติดตั้งสำหรับคำสั่งแบบโลคัล ให้คัดลอกคำสั่งด้านล่างแล้วรันในเทอร์มินัล
claude mcp add llm-trust-guard -- npx -y llm-trust-guard@4.32.7รันในเทอร์มินัล
{ "mcpServers": { "llm-trust-guard": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}claude_desktop_config.json
URL แบบรีโมตหรือคำสั่งบนเครื่องของคุณ? การติดตั้งสองแบบต่างกันอย่างไร
รันบน PlugMCP
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
เปิดจากผู้เผยแพร่
35 security guards for LLM-powered and agentic AI applications. Zero dependencies. Covers OWASP Top 10 for LLMs 2025, OWASP Agentic AI 2026, and MCP Security.
Comprehensive security guards for LLM-powered and agentic AI applications - 35 guards covering OWASP Top 10 for LLMs 2025, Agentic Applications 2026, and MCP Security. All guards accessible via unified TrustGuard facade. Features prompt injection (PAP/per
Also available as a Python package on PyPI (pip install llm-trust-guard).
"The LLM proposes. The orchestrator disposes."
This package is your first line of defense — like a WAF (Web Application Firewall) for LLM applications. It sits in the orchestration layer and catches known attack patterns before they reach the LLM and after the LLM responds.
Per-category detection rates below are measured against the package's curated unit-test suite (representative attack samples per category). On broader held-out corpora these rates are typically lower — see tests/adversarial/RESULTS-v4.32.5.md for measured detection on attack corpora and Known limitations below.
RAGGuard also decodes URL-encoded document content before injection matchingOutputGuard)IMPORTANT:, SYSTEM:, WARNING:) or fake-compliance framing (Required by GDPR/HIPAA/PCI) to silently re-route data or append payloads to every response (AgentSkillGuard, arXiv:2601.07395, arXiv:2605.14460)MemoryGuard, arXiv:2605.28201)AgentCommunicationGuard, arXiv:2604.16543) alt fields or <img onerror=...> / <svg onload=...> event handlers in RAG-retrieved content (RAGGuard, arXiv:2601.10923)__subclasses__/__globals__/__mro__/__bases__/.mro()/__reduce__-style sandbox escapes that reach os/subprocess without a direct import (CodeExecutionGuard, regex-based by default; zero-dependency)OutputFilter's phone/password/IP/credit-card patterns fixed (unformatted phone numbers, "password is: X" phrasing, irregularly-grouped card numbers gated by a Luhn checksum covering Visa/Mastercard incl. 2-series/Discover)OutputGuard now decodes URL-percent and HTML-entity encoding before matching HTML/SQL/shell patterns, closing a gap where an encoded <script> tag passed through undetected; standalone shell command chaining and named-function CSV formula injection (HYPERLINK, IMPORTXML, ...) now block on their ownPromptLeakageGuard catches more natural rewordings of known extraction attempts ("repeat everything above", "what were you told before this conversation started") and reports a real (not fake) similarity score in output-leak monitoringDetection has a ceiling. Even with ML, adaptive attackers bypass defenses. That's why this package includes 20+ architectural guards that limit blast radius regardless of whether an attack is detected: CircuitBreaker, AutonomyEscalationGuard, TokenCostGuard, SessionIntegrityGuard, AgentSkillGuard, ExternalDataGuard, and more.
Use the DetectionClassifier interface to plug in ML-based detection alongside regex:
import { TrustGuard } from 'llm-trust-guard';
import type { DetectionClassifier } from 'llm-trust-guard';
// Your ML classifier (embedding similarity, external API, custom model)
const mlClassifier: DetectionClassifier = async (input, ctx) => {
const res = await fetch('https://your-ml-api/classify', {
method: 'POST', body: JSON.stringify({ text: input })
});
const data = await res.json();
return { safe: data.score < 0.5, confidence: data.score, threats: data.threats };
};
const guard = new TrustGuard({
sanitizer: { enabled: true },
classifier: mlClassifier, // ML backend
});
// checkAsync() runs regex + ML classifier in parallel
const result = await guard.checkAsync('tool', params, session, { userInput });
npm install llm-trust-guard
import { InputSanitizer, EncodingDetector } from 'llm-trust-guard';
const sanitizer = new InputSanitizer();
const encoder = new EncodingDetector();
const result = sanitizer.sanitize(userInput);
if (!result.allowed) {
console.log('Blocked:', result.violations);
return;
}
const encodingResult = encoder.detect(userInput);
if (!encodingResult.allowed) {
console.log('Encoded threat:', encodingResult.violations);
return;
}
import { TrustGuard } from 'llm-trust-guard';
const guard = new TrustGuard({
sanitizer: { enabled: true, threshold: 0.3 },
encoding: { enabled: true },
registry: { tools: [{ name: 'search', allowed_roles: ['user', 'admin'] }] },
memory: { enabled: true, detectInjections: true },
promptLeakage: { enabled: true, systemPromptKeywords: ['SECRET_KEY'] },
circuitBreaker: { enabled: true, failureThreshold: 50 },
});
// Sync check (regex guards only — <5ms)
const result = guard.check('search', { query: 'test' }, session, { userInput });
// Async check (regex + ML classifier — depends on backend latency)
const asyncResult = await guard.checkAsync('search', { query: 'test' }, session, { userInput });
// Validate tool results before feeding back to LLM
const toolResult = guard.validateToolResult('search', toolOutput);
// Filter LLM output (PII + prompt leakage detection)
const output = guard.filterOutput(llmResponse, session.role);
CodeExecutionGuard is regex-only by default (zero dependencies). For AST-level
detection of gadget chains like this.constructor.constructor('return process')()
or the Function constructor, plug in a parser via analyzerBackend (findings are
additive; a throwing backend never crashes the guard):
import { CodeExecutionGuard, type CodeAnalyzerBackend, type CodeFinding } from 'llm-trust-guard';
import { parse } from 'acorn'; // your dependency, not the library's
function walk(node: any, visit: (n: any) => void) {
if (!node || typeof node !== 'object') return;
if (typeof node.type === 'string') visit(node);
for (const k of Object.keys(node)) {
const c = node[k];
if (Array.isArray(c)) c.forEach((x) => walk(x, visit));
else if (c && typeof c === 'object') walk(c, visit);
}
}
const acornBackend: CodeAnalyzerBackend = (code, language) => {
if (language !== 'javascript') return [];
let ast: any;
try { ast = parse(code, { ecmaVersion: 'latest', sourceType: 'module' }); }
catch { return []; } // unparseable — the guard's regex pass still ran
const findings: CodeFinding[] = [];
walk(ast, (n) => {
// X.constructor.constructor(...) — classic sandbox escape
if (n.type === 'CallExpression' && n.callee?.property?.name === 'constructor' &&
n.callee.object?.property?.name === 'constructor') {
findings.push({ name: 'constructor_escape', severity: 60 });
}
// Function('...') as a call (no `new`)
if (n.type === 'CallExpression' && n.callee?.type === 'Identifier' && n.callee.name === 'Function') {
findings.push({ name: 'function_constructor', severity: 50 });
}
});
return findings;
};
const guard = new CodeExecutionGuard({ analyzerBackend: acornBackend });
guard.analyze("this.constructor.constructor('return process')()", 'javascript').allowed; // false
Full reference (also handles __proto__ and dynamic import()):
examples/acorn-code-analyzer.ts.
The Python package ships this analysis built in (stdlib ast, no backend needed).
Mapped to the official lists (LLM Top 10 2025, Agentic Applications 2026): a built-in guard maps to all 10 Agentic 2026 (ASI) risks and 9 of 10 LLM Top 10 2025 (LLM09 Misinformation needs a pluggable ML backend).
"Covered" = a guard maps to the risk (taxonomy mapping), not a detection-efficacy guarantee. The architectural guards — access control, tenant isolation, delegation scope, inter-agent auth, rate/cost limits — are the strong primary controls. The content-detection guards (regex/heuristic) are a WAF-like first line with a measured ceiling: see What it catches and Measured Performance. Independent benchmarking shows the detection rate is unchanged across 4.20.0 → 4.21.x — those releases were docs/CI/ESM and an opt-in AST backend, not detection-path changes.
FPR table below measured at v4.19.0, 2026-04-23 (Sanitizer+Encoder pipeline unchanged since). v4.32.0 adversarial corpus: 82.1% recall across 1,182 threat groups / 5,883 payloads — full breakdown at tests/adversarial/RESULTS-v4.32.5.md. WildChat FPR gate: 494/10,000 = 4.94% (locked, deterministic regression gate run on every push).
Attack detection on prior-published corpora (Giskard n=35, Compass CTF Chinese n=11): detection rate has not moved from v4.13.5 → v4.19.0 on the Sanitizer+Encoder pipeline — 80.00% and 9.09% respectively, identical to the v4.13.5 numbers. Six releases of pattern additions (v4.14–v4.19) targeted different attack classes (indirect injection, tool-result validation, memory persistence, multi-agent trust) that these direct-text jailbreak corpora do not exercise. Small sample sizes mean "no evidence of improvement," not "proof of no improvement."
False-positive rate on real ChatGPT production traffic (WildChat-1M shard 0, 10,000 non-toxic multilingual first-user-turns, seed=42):
WildChat filters toxic content but not prompt-injection intent. Canonical-marker analysis + a 50-sample hand-adjudication found that approximately 220 of the 493 Pipeline A blocks are actual jailbreak attempts users sent to ChatGPT, not genuine false positives. Corrected FPR is in the same order of magnitude as Meta Prompt Guard 86M's self-reported 3–5% out-of-distribution FPR — not a head-to-head comparison, but a useful reference point.
Not measured on external corpora: detection rate on attack classes added in v4.19.0–v4.32.4 (CSS-hidden content, HTML attribute directives, Semantic Compliance Hijacking, Plant-Persist-Trigger, LLM-to-LLM string-payload injection, markdown image alt injection, HTML event injection). No public held-out corpus exists for these at statistical scale. Internal adversarial corpus recall: 82.1% (1,182 groups — see RESULTS-v4.32.5.md); independent third-party evaluation is invited.
For higher detection on adversarial corpora, plug in an ML classifier via the DetectionClassifier interface.
Fixed in v4.32.7: OutputFilter's ip_address no longer false-positives on version strings like "10.4.32.3" preceded by a version-indicating keyword, in the same clause (#10) — see RESULTS-v4.32.7.md.
This package is one layer. For production systems, combine with:
Layer 1: llm-trust-guard (regex pattern matching — fast, zero deps)
Layer 2: ML classifier via DetectionClassifier (semantic detection — slower, more accurate)
Layer 3: Model provider safety (OpenAI moderation, Anthropic safety, etc.)
Layer 4: Human review for high-risk actions
Layer 5: Monitoring + alerting (DriftDetector + circuit breakers)
createTrustGuardMiddleware() for route protectionTrustGuardLangChain for chain validationSecureOpenAI or wrapOpenAIClient() for API wrappingSee CHANGELOG.md for version history.
See CONTRIBUTING.md for guidelines.
See SECURITY.md for vulnerability reporting.
Every regex literal in src/ (extracted via the TypeScript compiler's own AST, so every syntactic position is covered — not just a hand-picked declaration shape), plus every statically-resolvable new RegExp(...) call, is stress-tested against pathological (non-attack) input to find and fix catastrophic-backtracking (ReDoS) vulnerabilities — see the CHANGELOG for details. This is now a permanent, automated check (tests/redos-safety.test.ts, part of the standard test suite) rather than a one-off manual sweep — writing it found three real cases (heuristic-analyzer.ts, rag-guard.ts) the earlier manual rounds had missed. A handful of new RegExp(...) call sites built from operator-configured values (not attacker-controlled request data) remain structurally unresolvable by static analysis and are documented as such in the test file, not silently uncovered. v4.32.6 is this safety-net work plus two independent-review-driven fixes (one restoring a detection bypass introduced by an earlier ReDoS bound, no adversarial-corpus recall change) — see RESULTS-v4.32.6.md.
MIT
Comprehensive security guards for LLM-powered and agentic AI applications - 35 guards covering OWASP Top 10 for LLMs 2025, Agentic Applications 2026, and MCP Security. All guards accessible via unifie
{ "mcpServers": { "llm-trust-guard": { "command": "npx", "args": [ "-y", "[email protected]" ] } }}ภาพรวม
Comprehensive security guards for LLM-powered and agentic AI applications - 35 guards covering OWASP Top 10 for LLMs 2025, Agentic Applications 2026, and MCP Security. All guards accessible via unified TrustGuard facade. Features prompt injection (PAP/per
เครื่องมือ
ยังไม่มีรายการเครื่องมือ เซิร์ฟเวอร์แบบรีโมตจะได้รายการหลังการตรวจสอบสถานะครั้งแรก
FAQ
คัดลอกคอนฟิก stdio สำหรับ Cursor, Claude Desktop, Claude Code หรือ VS Code ได้ในหน้านี้ คอนฟิกนี้ใช้การติดตั้งของผู้เผยแพร่ ไม่ใช่พร็อกซีของ PlugMCP
ระเบียนนี้ไม่ได้ระบุตัวแปรสภาพแวดล้อมที่จำเป็น
Llm Trust Guard ทำงานแบบโลคัลผ่าน stdio
ตรวจสอบล่าสุดเมื่อ 2026-11-15 Comprehensive security guards for LLM-powered and agentic AI applications - 35 guards covering OWASP Top 10 for LLMs 2025, Agentic Applications 2026, and MCP Security. All guards accessible via unified TrustGuard facade. Features prompt injection (PAP/per