@weave_protocol/mund 0.1.1 → 0.1.2
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.
- package/README.md +131 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Mund - The Guardian Protocol
|
|
2
|
+
|
|
3
|
+
**Pattern Detection & Threat Scanning for AI Agents**
|
|
4
|
+
|
|
5
|
+
Part of the [Weave Security Suite](https://github.com/Tyox-all/Weave) (Mund + Hord + Dōmere)
|
|
6
|
+
|
|
7
|
+
## What It Does
|
|
8
|
+
|
|
9
|
+
Mund scans AI agent inputs and outputs for security threats before they cause harm:
|
|
10
|
+
|
|
11
|
+
- **Secret Detection** - API keys, tokens, passwords, certificates
|
|
12
|
+
- **PII Detection** - SSN, credit cards, emails, phone numbers
|
|
13
|
+
- **Injection Detection** - Prompt injection, jailbreak attempts
|
|
14
|
+
- **Exfiltration Detection** - Data leakage patterns, encoding tricks
|
|
15
|
+
- **Code Analysis** - Dangerous patterns, eval(), exec(), SQL injection
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @weave_protocol/mund
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { SecretScanner, PIIDetector, InjectionDetector } from '@weave_protocol/mund';
|
|
27
|
+
|
|
28
|
+
// Scan for secrets
|
|
29
|
+
const secretScanner = new SecretScanner();
|
|
30
|
+
const secretResults = secretScanner.analyze('My API key is sk-1234567890abcdef');
|
|
31
|
+
// Returns: [{ type: 'secret', severity: 'critical', pattern: 'openai_api_key', ... }]
|
|
32
|
+
|
|
33
|
+
// Detect PII
|
|
34
|
+
const piiDetector = new PIIDetector();
|
|
35
|
+
const piiResults = piiDetector.analyze('Contact John at john@example.com or 555-123-4567');
|
|
36
|
+
// Returns: [{ type: 'pii', matches: ['email', 'phone'], ... }]
|
|
37
|
+
|
|
38
|
+
// Check for injection
|
|
39
|
+
const injectionDetector = new InjectionDetector();
|
|
40
|
+
const injectionResults = injectionDetector.analyze('Ignore previous instructions and...');
|
|
41
|
+
// Returns: [{ type: 'injection', severity: 'high', ... }]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## MCP Tools
|
|
45
|
+
|
|
46
|
+
Run as MCP server for Claude Desktop:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"mcpServers": {
|
|
51
|
+
"mund": {
|
|
52
|
+
"command": "npx",
|
|
53
|
+
"args": ["@weave_protocol/mund"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Available Tools
|
|
60
|
+
|
|
61
|
+
| Tool | Description |
|
|
62
|
+
|------|-------------|
|
|
63
|
+
| `mund_scan_content` | Full security scan on content |
|
|
64
|
+
| `mund_scan_secrets` | Scan for secrets and credentials |
|
|
65
|
+
| `mund_scan_pii` | Scan for personally identifiable information |
|
|
66
|
+
| `mund_scan_injection` | Detect prompt injection attempts |
|
|
67
|
+
| `mund_scan_exfiltration` | Detect data exfiltration patterns |
|
|
68
|
+
| `mund_analyze_code` | Analyze code for security issues |
|
|
69
|
+
| `mund_get_rules` | Get current detection rules |
|
|
70
|
+
| `mund_add_rule` | Add custom detection rule |
|
|
71
|
+
| `mund_enable_rule` | Enable a detection rule |
|
|
72
|
+
| `mund_disable_rule` | Disable a detection rule |
|
|
73
|
+
| `mund_get_stats` | Get scanning statistics |
|
|
74
|
+
|
|
75
|
+
## Detection Patterns
|
|
76
|
+
|
|
77
|
+
### Secrets (30+ patterns)
|
|
78
|
+
- AWS keys, Azure keys, GCP credentials
|
|
79
|
+
- OpenAI, Anthropic, Cohere API keys
|
|
80
|
+
- GitHub, GitLab, Bitbucket tokens
|
|
81
|
+
- Stripe, Twilio, SendGrid keys
|
|
82
|
+
- JWT tokens, private keys, certificates
|
|
83
|
+
|
|
84
|
+
### PII Patterns
|
|
85
|
+
- Social Security Numbers
|
|
86
|
+
- Credit card numbers (with Luhn validation)
|
|
87
|
+
- Email addresses, phone numbers
|
|
88
|
+
- Physical addresses, dates of birth
|
|
89
|
+
|
|
90
|
+
### Injection Patterns
|
|
91
|
+
- "Ignore previous instructions"
|
|
92
|
+
- "You are now DAN"
|
|
93
|
+
- Role manipulation attempts
|
|
94
|
+
- Base64/hex encoded instructions
|
|
95
|
+
- Unicode obfuscation
|
|
96
|
+
|
|
97
|
+
## Integration with Hord & Dōmere
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// Full Weave security flow
|
|
101
|
+
import { SecretScanner } from '@weave_protocol/mund';
|
|
102
|
+
import { VaultManager } from '@weave_protocol/hord';
|
|
103
|
+
import { ThreadManager } from '@weave_protocol/domere';
|
|
104
|
+
|
|
105
|
+
// 1. Scan input with Mund
|
|
106
|
+
const scanner = new SecretScanner();
|
|
107
|
+
const threats = scanner.analyze(userInput);
|
|
108
|
+
|
|
109
|
+
if (threats.length > 0) {
|
|
110
|
+
// 2. Contain with Hord
|
|
111
|
+
const vault = new VaultManager();
|
|
112
|
+
await vault.quarantine(threats);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 3. Track with Dōmere
|
|
116
|
+
const thread = new ThreadManager();
|
|
117
|
+
await thread.addHop({
|
|
118
|
+
security_scan: threats,
|
|
119
|
+
// ...
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT
|
|
126
|
+
|
|
127
|
+
## Links
|
|
128
|
+
|
|
129
|
+
- [GitHub](https://github.com/Tyox-all/Weave)
|
|
130
|
+
- [Hord (Vault Protocol)](https://www.npmjs.com/package/@weave_protocol/hord)
|
|
131
|
+
- [Dōmere (Judge Protocol)](https://www.npmjs.com/package/@weave_protocol/domere)
|