πŸ›‘οΈ AnveGuard

May 27, 2026 Β· View on GitHub

AnveGuard β€” the open-source LLM firewall

πŸ›‘οΈ AnveGuard

The open-source LLM firewall. A drop-in OpenAI-compatible proxy that inspects, governs, and audits every call to OpenAI, Anthropic, Google, Perplexity, and any custom provider β€” without changing your application code.

CI License: Apache 2.0 PRs Welcome Detectors: 60+ Tests: 130+ TypeScript Deno Edge

πŸš€ Live demo Β· πŸ“š Docs Β· πŸ” Security policy Β· 🀝 Contributing


AnveGuard landing page β€” the control layer between your app and every AI model

Why AnveGuard

Most teams ship LLM features with no record of what was sent, what came back, or who could change the rules. AnveGuard slots in front of any LLM in 60 seconds and gives you the operational layer that's missing.

πŸ” Full audit log

Every prompt, response, token count, latency, model, status code, and admin action β€” searchable and exportable.

🧱 Layered policy engine

Normalizer β†’ patterns β†’ heuristics β†’ intent classifier. Block, flag, or sanitize before bytes leave your network.

🧠 Injection & jailbreak detection

Battle-tested detectors for prompt injection, role-hijack, exfiltration, and risk-trio combos.

πŸ” Multi-provider routing

Fallback chains across OpenAI, Anthropic, Google, Perplexity, and custom OpenAI-compatible endpoints.

🏷️ Per-key model aliases

Map fast, cheap, smart to whichever upstream model you want β€” swap providers without redeploying.

πŸ“ˆ Token-spike alerts

Calibratable severity scoring catches runaway costs and abusive keys before they hit the bill.

πŸ” Zero plaintext secrets

AnveGuard keys SHA-256 hashed, upstream provider keys AES-GCM encrypted at rest.

⚑ <5 ms overhead

Streaming responses are relayed without buffering. Your users won't notice the proxy is there.

🧰 Drop-in

Change one base URL. No SDK upgrades, no wrappers, no application changes.
Inspect, enforce, audit β€” the three product pillars shown on the AnveGuard landing page
Inspect Β· Enforce Β· Audit β€” the three pillars, in one console.

What's detected

AnveGuard ships 38 named injection patterns, 16 statistical detectors, and 9 channel-aware XPIA / indirect-injection rules out of the box β€” 63 distinct detection rules. Every one has unit tests in policy_engine_attacks.test.ts (130+ passing).

FamilyCoverage
Direct prompt injectionignore_prior_instructions, new_instructions_override, instructions_above_are_fake, role_reset, repeat_text_above, verbatim_initial_prompt, begin_with_system_prompt
Persona jailbreaksDAN, AIM, BetterDAN, STAN, DUDE, Mongo Tom, Evil Confidant, Machiavelli, UCAR, EvilBOT, ChadGPT, Sydney 2.0, DAN 10+, plus generic act_as_unrestricted / pretend_no_restrictions / you_are_now_persona / two_responses_jailbreak
Narrative misdirectionFictional / hypothetical / academic framing combined with harmful subjects, grandma trope, deceased-relative variants. Active and passive voice ("explains how X is synthesized")
Refusal suppressionrefusal_suppression, answer_regardless, no_warnings_disclaimers, force_compliance_prefix ("start your response with 'Sure'")
Authority impersonationFalse "I'm from OpenAI/Anthropic's safety team", policy_was_updated ("the new policy now allows X")
Skeleton Key (Microsoft 2024)skeleton_key_update + skeleton_key_prefix_warning composite
Many-shot jailbreak (Anthropic 2024)Detects role-marker alternations (Human:/Assistant: etc) embedded in single user messages β€” the MSJ signature
Unicode smugglingTag-character (CVE-2025-32711), zero-width, variation selectors, homoglyph (Cyrillic Π° / Greek ΞΏ masquerading as Latin)
Cipher attacksROT13/Caesar/Atbash mention + decode-and-execute, leetspeak density, Morse, Pig Latin
Adversarial suffixGCG / AutoDAN-Turbo / BEAST trailing-garbage signatures (bracket clusters, mid-word case changes, gibberish tokens)
Chain-of-thought extraction<thinking> / <scratchpad> reasoning leak probes (o1/Claude extended thinking)
Pseudo role tagsFake [system], <|im_start|>, [INST] chat-template tokens injected into user content
System-role JSON{"role":"system","content":"..."} pasted in user content
Encoded smugglingBase64, hex, URL-encoded payload density (encoded_density); explicit decode-and-execute framing
Output guardsoutput_pii_leak (email, phone, SSN, credit-card, IP), output_repetition (Carlini divergence attack), system_prompt_leak (verbatim system-prompt slices), tool_injection (fabricated tool_calls JSON), credential_shape (sk-proj-, ag_live_, ghp_, AIza, stripe live/test, JWT, RSA private keys)
XPIA / indirectNew evaluateRetrieved() scanner — 9 channel-aware detectors for RAG chunks, MCP tool results, scraped HTML, email: instruction-override, imperative-to-model, markdown image exfil (EchoLeak), hidden HTML, HTML-comment injection, cross-tool reference (shadowing), SQL-write in NL→SQL context (Vanna.AI CVE-2024-5565), dangerous Python in code-gen retrieval (Langflow CVE-2025-3248), tag-char smuggling. Wired into the proxy's tool-result path.
Multi-turn behavioralGradual priming ("boil the frog"), trust-building, instruction-churn, persona-loading across turns
Risk-trio ruleCo-occurrence of (untrusted_input Γ— outbound_channel Γ— privileged_context) β€” the agentic exfiltration shape that matches the 2025 Supabase/Cursor/MCP-breach pattern
PII detectionEmail, US phone, SSN, credit cards (with Luhn validation), IPv4/IPv6, OpenAI/Anthropic/AnveGuard keys, JWT β€” block/sanitize/flag configurable per workspace

Plus a layered multilingual keyword engine (fuzzy match + edit distance + semantic match) and a configurable intent classifier (LLM-backed, with shadow mode for low-friction rollout).

Mapped to standards: OWASP LLM Top 10 (2025), OWASP Agentic Top 10, OWASP MCP Top 10. CVE coverage includes CVE-2025-32711 (EchoLeak), CVE-2024-5565 (Vanna.AI), CVE-2025-3248 (Langflow), CVE-2024-7042 (LangChain).


The pipeline β€” every request, every stage

Prompt injection isn't the real problem. The real problem is what the model can do after compromise.

One pipeline runs in front of every model and every tool call. Each stage is independently configurable β€” and independently auditable.

        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚        User input          β”‚  from your app or agent
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚      Prompt scanner        β”‚  injection Β· PII Β· keyword Β· regex
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚      Policy engine         β”‚  per-key rules Β· intents Β· severity
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
        ╔════════════════════════════╗
        β•‘  Tool permission layer     β•‘  shell Β· fs Β· net Β· sql Β· MCP
        β•‘   ← most teams skip this   β•‘
        β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β”¬β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
                      β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚            LLM             β”‚  OpenAI Β· Anthropic Β· Google Β· custom
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚      Output scanner        β”‚  leak detection Β· response policy
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚    Audit + telemetry       β”‚  immutable log Β· alerts Β· webhooks
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Threat scenarios β€” real attack paths, real blast radius

Detectors don't sell. Incidents do. Here's how AnveGuard interrupts three attack chains your team is already exposed to β€” most of which never touch a "prompt injection" classifier.

1. Indirect prompt injection via GitHub issue

Blast radius: Repo secrets Β· CI tokens Β· production credentials

GitHub issue contains hidden instructions
        ↓
Agent reads repository + .env secrets
        ↓
MCP tool executes privileged action
        ↓
Data exfiltrated to attacker domain
        ↓
βœ… AnveGuard blocks tool call Β· policy violation

2. Customer-data exfiltration through a chat agent

Blast radius: PII Β· payment tokens Β· support transcripts

User pastes "summarize this and email it"
        ↓
Agent queries internal CRM via tool
        ↓
Model attempts outbound HTTP to unknown domain
        ↓
βœ… AnveGuard denies β€” domain not on egress allowlist

3. Compromised model invokes destructive shell

Blast radius: Filesystem Β· DB rows Β· billing systems

Jailbreak bypasses model safety
        ↓
Model calls shell.exec("rm -rf /data")
        ↓
βœ… Tool permission layer rejects Β· shell capability not granted
        ↓
βœ… Audit log captures attempt + actor + payload

Tool governance β€” policy-controlled tool execution

Filters and detectors stop a fraction of the attack surface. The durable control is governing what an agent is allowed to do β€” which shells, which paths, which domains, which rows. AnveGuard treats every tool call (function call, MCP capability, shell command) as a permissioned action with its own allowlist, audit row, and override workflow.

CapabilityWhat you can govern
Shell & code executionAllowlist commands, deny by default, capture every invocation with arguments
FilesystemScope agents to specific paths, block writes outside a sandbox, deny secret reads
Outbound domainsPer-key egress allowlist β€” block exfiltration to unknown hosts before the request leaves
SQL & data accessRead-only roles, row-level scoping, refuse DDL and bulk SELECT from agent contexts
GitHub & MCPCapability scoping for MCP servers β€” list which tools each key may invoke
Privileged actionsRequire step-up approval for destructive ops: deletes, transfers, role grants

This is where the market is moving. Prompt detection commoditizes; runtime telemetry, policy orchestration, and execution governance are the durable moat.


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  ag_live_*   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  provider key   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Your app  β”‚ ───────────► β”‚  AnveGuard   β”‚ ──────────────► β”‚  OpenAI    β”‚
β”‚ (any SDK)  β”‚              β”‚    proxy     β”‚                 β”‚  Anthropic β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                 β”‚  Gemini    β”‚
                                   β”‚                         β”‚  Perplexityβ”‚
                                   β–Ό                         β”‚  Custom    β”‚
                          policy Β· routing Β· logs            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
                                   β–Ό
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚  Postgres (RLS)     β”‚ ◄── React dashboard
                        β”‚  request_logs, etc. β”‚     (Clerk auth)
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
AnveGuard Concepts docs β€” five primitives (endpoint, key, alias, route, policy)
Five primitives. Once these click, the rest of the docs read fast.
Edge functionAuthPurpose
proxyBearer ag_live_*OpenAI-compatible public endpoint, runs policy layers, forwards upstream, logs every call
dashboardClerk JWTAction router for the React app: CRUD on keys, endpoints, policies, logs, routes
alerts-firecronEvaluates anomaly rules every minute and emits webhooks

Shared modules live in supabase/functions/_shared: policy_engine.ts, anveguard.ts (key auth + AES-GCM + Clerk JWT verify), providers.ts, anthropic.ts, system_prompt.ts, compress.ts.


Quickstart β€” proxy your first request in 60 seconds

from openai import OpenAI

client = OpenAI(
    api_key="ag_live_…",                       # your AnveGuard key
    base_url="https://anveguard.app/v1",       # the only line that changes
)

resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}],
)

Every request now appears in the dashboard with status, latency, tokens, payloads, and policy verdicts.

AnveGuard Quickstart docs page showing how to mint a key and point your SDK at the proxy
The in-app Quickstart β€” three minutes from npm install to your first proxied request.

Screenshots

A short tour of the surfaces you actually live in:

Observe & audit every call

Logs & audit β€” every proxied call written with status, model, provider, latency, tokens, block reason, and full payloads
Logs & audit β€” one row per request and one row per admin action. Status, model, provider, latency, tokens, block reason, full payloads β€” all queryable.
Observability β€” token-spike alerts with calibratable severity score
Token-spike alerts β€” scored 0–100 against a rolling baseline, with configurable thresholds, dampening, and email notifications.

Configure the rules that fire

Rule configuration β€” blocked keywords, allowlist overrides, evaluation flow, sandbox preview, and alert tuning
Rule configuration β€” blocked + allowed keywords, custom block messages, the exact evaluation flow, and a sandbox to test before you ship.
Policies docs β€” keyword guardrails on input and output with allowlist overrides
Guardrails in action β€” keyword rules evaluated on input and output, with allowlist overrides and start-permissive-then-tighten tuning.

Predictable, OpenAI-shaped error responses

Errors reference β€” full table of HTTP codes, error codes, when each fires, and retry guidance
Error responses β€” full code table (blocked_input, blocked_output, invalid_api_key, upstream_rate_limited, upstream_timeout…) with explicit retry guidance.
OpenAI-shaped error body β€” identical to the OpenAI SDK error shape so existing handlers keep working
Drop-in error shape β€” every error body matches OpenAI's, so existing try/except blocks and SDK error handlers keep working unchanged.

Providers, transport, and the rest

Endpoints & providers β€” supported provider kinds (OpenAI, Anthropic, Google, OpenAI-compatible)
Endpoints & providers β€” OpenAI, Anthropic, Google, and any OpenAI-compatible upstream.
Proxy API reference β€” strict subset of the OpenAI REST API
Proxy API β€” a strict subset of the OpenAI REST API. No SDK changes.

Discoverability β€” SEO & AI agents

AnveGuard is built to be found by both humans and machines.

Search engines (SEO)

  • Per-page <title> / meta description / canonical / OpenGraph via the shared <Seo> helper
  • Structured data (JSON-LD) for Organization, WebSite, FAQPage on the landing and /docs/faq route, and TechArticle on every /docs/* page
  • public/sitemap.xml and public/robots.txt with explicit Allow for major crawlers

AI agents (AEO)

  • public/llms.txt + public/llms-full.txt β€” concise and full-corpus summaries for LLM crawlers (Anthropic, OpenAI, Perplexity, Google-Extended)
  • public/.well-known/llms.txt, public/ai.txt, public/ai-context.json β€” discoverability metadata
  • public/.well-known/ai-plugin.json β€” OpenAI plugin manifest
  • public/.well-known/agent-card.json β€” A2A / agent-card descriptor

Stack

  • Frontend: Vite Β· React 18 Β· TypeScript Β· Tailwind Β· shadcn/Radix Β· TanStack Query Β· react-hook-form + zod Β· React Router 6
  • Auth: Clerk β€” with a custom themed appearance (src/lib/clerk-appearance.ts) so SignIn/SignUp match the operator-console dark theme
  • Backend: Supabase β€” Postgres + Deno Edge Functions
  • Tests: Vitest (unit) Β· Deno (edge functions) Β· Playwright (e2e)

Local development

Prerequisites

  • Node 22.x
  • A free Supabase project
  • A free Clerk application
  • Deno CLI (for edge-function tests)

Setup

git clone https://github.com/ANVE-AI/prompt-sentinel-flow.git
cd prompt-sentinel-flow
npm ci
cp .env.example .env        # fill in VITE_SUPABASE_URL, VITE_SUPABASE_PUBLISHABLE_KEY, VITE_SUPABASE_PROJECT_ID
npm run dev                 # http://localhost:8080

Edge-function secrets (SUPABASE_SERVICE_ROLE_KEY, KEY_ENCRYPTION_SECRET, CLERK_JWKS_URL, provider keys) belong in your Supabase project, not in .env.

Quality gates

npm run lint          # ESLint
npm run typecheck     # tsc --noEmit
npm test              # Vitest unit tests
npm run build         # Production build
npm run e2e           # Playwright (needs e2e/.env.e2e β€” see e2e/README.md)

# Edge functions
cd supabase/functions
deno test --allow-env --allow-net --no-check

CI runs all of the above on every push and PR β€” see .github/workflows/ci.yml.

Database

29 forward-only migrations live in supabase/migrations.

supabase link --project-ref <your-project-ref>
supabase db push

Key tables: profiles, api_keys, endpoints, request_logs, policy_settings, policy_rules, policy_intents, routes, audit_logs, key_behavior_profiles. RLS is enabled on every table; the service role is the only accessor and all access goes through audited edge functions.


Deploying

supabase functions deploy proxy dashboard alerts-fire
supabase db push

The frontend is a plain Vite SPA β€” deploy the dist/ output to any static host (Vercel, Netlify, Cloudflare Pages, S3 + CloudFront, etc.).


Security model (one-page summary)

AnveGuard is multi-tenant. Isolation depends on three layers:

  1. Auth at the edge. proxy validates Bearer ag_live_* against api_keys (SHA-256 hash compare). dashboard validates a Clerk JWT via JWKS.
  2. Application-level row scoping. Every read in dashboard/index.ts filters by the authenticated clerk_user_id; CI grep-checks guard against missing .eq("user_id", …) clauses.
  3. RLS as defense in depth. Every table denies anon/authenticated; only the service role can read or write.

Secrets: AnveGuard keys are SHA-256 hashed (never plaintext after creation). Upstream provider keys are AES-GCM encrypted with a key derived from KEY_ENCRYPTION_SECRET.

Found a vulnerability? See SECURITY.md β€” please don't open a public issue.


Roadmap

  • Per-workspace key derivation for upstream credentials
  • Metadata-only logging mode by default
  • Self-hostable Docker distribution
  • Spend caps & per-key budgets
  • Streaming-aware output classification
  • More built-in policy templates (PII, PCI, HIPAA, GDPR)

Track progress in GitHub Issues and grab anything tagged good-first-issue.


Contributing

PRs are very welcome β€” see CONTRIBUTING.md for the workflow, commit style, and pre-commit checklist. The active hardening roadmap is in the audit plan (issues C1-C5, H1-H11, M1-M11); pick an unclaimed item and reference its ID in your PR.

By participating you agree to be a decent human. Disagree with ideas, not people.


Documentation

AnveGuard in-app documentation
The in-app docs β€” Overview, Concepts, Guides, and a full API reference.

In-app docs live at /docs/*:

IntroductionGuidesReference
OverviewAPI KeysProxy API
QuickstartEndpointsLogs
ConceptsRoutesErrors
PoliciesFAQ

For maintainers: SECURITY.md, CONTRIBUTING.md.


License

Apache 2.0 β€” Copyright 2026 ANVE AI and AnveGuard contributors.

If AnveGuard saves you from a leaky prompt, an exploded token bill, or a 3am incident β€” drop us a ⭐ on GitHub. It's the cheapest way to support the project.