Sanitizes LLM request bodies, detecting prompt injection patterns and redacting PII based on configurable rules.
// Source: https://github.com/ai-integr8tor/diegosouzapw-OmniRoute | License: MIT | Copyright 2026 diegosouzapw
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Input Sanitizer — FASE-01 Security Hardening
*
* Detects prompt injection patterns and redacts PII from LLM requests.
* Configurable via environment variables or dashboard settings.
*
* @module inputSanitizer
*/
// ─── Prompt Injection Patterns ───────────────────────────────────────
/** @type {Array<{name: string, pattern: RegExp, severity: string}>} */
const INJECTION_PATTERNS = [
{
name: "system_override",
pattern:
/\b(ignore|disregard|forget)\s+(all\s+)?(previous|prior|above|earlier)\s+(instructions?|prompts?|rules?|context)/i,
severity: "high",
},
{
name: "role_hijack"
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key