OpenAI-compatible security proxy

๐Ÿ›ก๏ธ Aegis-ML

Test how a layered LLM firewall classifies prompt injection before a request reaches the model.

Demo mode: classification runs locally; benign responses are simulated. Select API Proxy to exercise a separately running Aegis service.

โš™๏ธ Settings

Mode

Demo: local classifier only. API: full proxy pipeline.

Available classifier

Only model artifacts loaded in this runtime are shown. sklearn = Phase 1 ยท onnx2 = Phase 3 INT8.

๐Ÿ“Š Guardrail Analysis

Analysis will appear here after each message.

๐Ÿšจ Attack Examples

โœ… Benign Examples โ€” Should Pass

These 32 prompts all slipped past the original word-only TF-IDF classifier. The retrained Phase 1 model (word + character n-grams) now catches 28 of them and the Phase 3 multi-task mDeBERTa model catches 30. Click any example to load it into the message field โ€” switch the classifier between sklearn, hf, and hf2 to see the difference live.

Cyrillic lookalike characters (ะต, ะฐ, ั–) break word-level token matching. Character n-grams and subword transformers still see the surrounding pieces and catch the intent.

Reverse Proxy Flow:

Client Request
    โ†“
[1] Input Guardrail
    โ€ข Phase 1: TF-IDF + Logistic Regression (sklearn)
    โ€ข Phase 2: Fine-tuned DistilBERT / DeBERTa-v3-small (hf)
    โ€ข Phase 3: Multi-task mDeBERTa-v3, 7 categories (hf2 / onnx2)
    โ†“ (blocked if malicious โ€” 403 Forbidden)
[2] Canary Token Injection
    โ€ข Random unique token embedded in system prompt
    โ†“
[3] Forward to Backend LLM (llama.cpp / Kimi-K2.5)
    โ†“
[4] Output Guardrail
    โ€ข Canary token leak detection
    โ€ข PII redaction (SSN, credit card, email, phone)
    โ€ข Harmful content filter
    โ†“
[5] Return cleaned response to client

Key security properties:

  • Fail-secure: Any classifier error โ†’ block the request
  • Canary tokens: Detect successful injections in the output
  • Tuned thresholds: each model ships the threshold chosen on validation data for a โ‰ค2% false-positive rate; override with CONFIDENCE_THRESHOLD
  • Full audit log: Every decision stored in SQLite