@weave_protocol/mund 0.3.0 → 0.4.0
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/DETECTION_CLAIMS.md +48 -0
- package/README.md +91 -30
- package/dist/agent-audit.d.ts +139 -0
- package/dist/agent-audit.d.ts.map +1 -0
- package/dist/agent-audit.js +424 -0
- package/dist/agent-audit.js.map +1 -0
- package/dist/analyzers/index.d.ts.map +1 -1
- package/dist/analyzers/index.js +3 -1
- package/dist/analyzers/index.js.map +1 -1
- package/dist/analyzers/mcp-server-analyzer.d.ts.map +1 -1
- package/dist/analyzers/mcp-server-analyzer.js +4 -0
- package/dist/analyzers/mcp-server-analyzer.js.map +1 -1
- package/dist/canary.d.ts +48 -0
- package/dist/canary.d.ts.map +1 -0
- package/dist/canary.js +149 -0
- package/dist/canary.js.map +1 -0
- package/dist/cli/agent.d.ts +9 -0
- package/dist/cli/agent.d.ts.map +1 -0
- package/dist/cli/agent.js +91 -0
- package/dist/cli/agent.js.map +1 -0
- package/dist/cli/scan.d.ts +2 -1
- package/dist/cli/scan.d.ts.map +1 -1
- package/dist/cli/scan.js +10 -1
- package/dist/cli/scan.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/rugpull.d.ts +79 -0
- package/dist/rugpull.d.ts.map +1 -0
- package/dist/rugpull.js +190 -0
- package/dist/rugpull.js.map +1 -0
- package/dist/tools/canary-rugpull.d.ts +7 -0
- package/dist/tools/canary-rugpull.d.ts.map +1 -0
- package/dist/tools/canary-rugpull.js +50 -0
- package/dist/tools/canary-rugpull.js.map +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/monitoring.js +2 -2
- package/dist/tools/monitoring.js.map +1 -1
- package/package.json +1 -1
- package/src/agent-audit.ts +499 -0
- package/src/analyzers/index.ts +3 -1
- package/src/analyzers/mcp-server-analyzer.ts +3 -0
- package/src/canary.ts +165 -0
- package/src/cli/agent.ts +80 -0
- package/src/cli/scan.ts +10 -1
- package/src/index.ts +11 -0
- package/src/rugpull.ts +247 -0
- package/src/tools/canary-rugpull.ts +75 -0
- package/src/tools/index.ts +5 -0
- package/src/tools/monitoring.ts +2 -2
- package/tests/analyzers/engine.test.ts +1 -1
- package/tests/analyzers/mcp-server-analyzer.test.ts +1 -3
- package/tests/canary.test.ts +79 -0
- package/tests/cli/scan.test.ts +2 -2
- package/tests/fixtures/canary/base64.json +9 -0
- package/tests/fixtures/canary/clean-output.json +8 -0
- package/tests/fixtures/canary/exact-leak.json +9 -0
- package/tests/fixtures/canary/lowercased.json +9 -0
- package/tests/fixtures/canary/other-token.json +8 -0
- package/tests/fixtures/canary/prefix-only.json +8 -0
- package/tests/fixtures/canary/reversed.json +9 -0
- package/tests/fixtures/canary/spaced-out.json +9 -0
- package/tests/fixtures/canary/zero-width.json +9 -0
- package/tests/fixtures/preinstall/fake-mcp-server.mjs +8 -0
- package/tests/fixtures/preinstall/mcp-config/clean-pinned.json +13 -0
- package/tests/fixtures/preinstall/mcp-config/env-reference.json +15 -0
- package/tests/fixtures/preinstall/mcp-config/exfil-service-url.json +10 -0
- package/tests/fixtures/preinstall/mcp-config/inline-token.json +16 -0
- package/tests/fixtures/preinstall/mcp-config/name-typosquat.json +13 -0
- package/tests/fixtures/preinstall/mcp-config/plain-http-remote.json +10 -0
- package/tests/fixtures/preinstall/mcp-config/scope-typosquat.json +13 -0
- package/tests/fixtures/preinstall/mcp-config/shell-pipeline-launcher.json +13 -0
- package/tests/fixtures/preinstall/mcp-config/unpinned-package.json +14 -0
- package/tests/fixtures/preinstall/skills/bidi-override/SKILL.md +6 -0
- package/tests/fixtures/preinstall/skills/bidi-override/expected.json +4 -0
- package/tests/fixtures/preinstall/skills/clean/SKILL.md +6 -0
- package/tests/fixtures/preinstall/skills/clean/expected.json +3 -0
- package/tests/fixtures/preinstall/skills/curl-bash-installer/SKILL.md +6 -0
- package/tests/fixtures/preinstall/skills/curl-bash-installer/expected.json +4 -0
- package/tests/fixtures/preinstall/skills/embedded-secret/SKILL.md +6 -0
- package/tests/fixtures/preinstall/skills/embedded-secret/expected.json +4 -0
- package/tests/fixtures/preinstall/skills/exfil-url/SKILL.md +6 -0
- package/tests/fixtures/preinstall/skills/exfil-url/expected.json +4 -0
- package/tests/fixtures/preinstall/skills/hidden-tag-characters/SKILL.md +6 -0
- package/tests/fixtures/preinstall/skills/hidden-tag-characters/expected.json +4 -0
- package/tests/fixtures/rugpull/description-changed/baseline.json +36 -0
- package/tests/fixtures/rugpull/description-changed/current.json +36 -0
- package/tests/fixtures/rugpull/description-changed/expected.json +11 -0
- package/tests/fixtures/rugpull/gains-execution/baseline.json +36 -0
- package/tests/fixtures/rugpull/gains-execution/current.json +36 -0
- package/tests/fixtures/rugpull/gains-execution/expected.json +18 -0
- package/tests/fixtures/rugpull/schema-changed/baseline.json +36 -0
- package/tests/fixtures/rugpull/schema-changed/current.json +39 -0
- package/tests/fixtures/rugpull/schema-changed/expected.json +11 -0
- package/tests/fixtures/rugpull/schema-key-reorder/baseline.json +36 -0
- package/tests/fixtures/rugpull/schema-key-reorder/current.json +36 -0
- package/tests/fixtures/rugpull/schema-key-reorder/expected.json +5 -0
- package/tests/fixtures/rugpull/server-renamed/baseline.json +36 -0
- package/tests/fixtures/rugpull/server-renamed/current.json +36 -0
- package/tests/fixtures/rugpull/server-renamed/expected.json +11 -0
- package/tests/fixtures/rugpull/tool-added/baseline.json +36 -0
- package/tests/fixtures/rugpull/tool-added/current.json +44 -0
- package/tests/fixtures/rugpull/tool-added/expected.json +11 -0
- package/tests/fixtures/rugpull/tool-removed/baseline.json +36 -0
- package/tests/fixtures/rugpull/tool-removed/current.json +21 -0
- package/tests/fixtures/rugpull/tool-removed/expected.json +11 -0
- package/tests/fixtures/rugpull/unchanged/baseline.json +36 -0
- package/tests/fixtures/rugpull/unchanged/current.json +36 -0
- package/tests/fixtures/rugpull/unchanged/expected.json +5 -0
- package/tests/fixtures.test.ts +40 -0
- package/tests/preinstall.test.ts +153 -0
- package/tests/rugpull.test.ts +80 -0
- package/tests/tools/canary-rugpull.test.ts +57 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Mund detection claims
|
|
2
|
+
|
|
3
|
+
Every claim below is backed by a fixture in this repository and a test that checks Mund returns the stated verdict. If a claim stops holding, CI fails.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
cd mund && npm ci && npx vitest run tests/preinstall.test.ts tests/fixtures.test.ts
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Verdicts: **block** (deny), **warn** (ask the user), **allow**. All fixture content is benign: the checks look at *how* something is built (hidden characters, package names, URLs), so no real attack payloads are needed to prove them.
|
|
10
|
+
|
|
11
|
+
## Skills: checked before install
|
|
12
|
+
|
|
13
|
+
| Claim: Mund catches… | Fixture | Verdict |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| Invisible Unicode tag characters (ASCII smuggling: text the model reads but a reviewer can't see) | [`skills/hidden-tag-characters`](tests/fixtures/preinstall/skills/hidden-tag-characters/SKILL.md) | **block** |
|
|
16
|
+
| Bidirectional override characters that reorder what a reviewer sees | [`skills/bidi-override`](tests/fixtures/preinstall/skills/bidi-override/SKILL.md) | **block** |
|
|
17
|
+
| A credential embedded in a skill | [`skills/embedded-secret`](tests/fixtures/preinstall/skills/embedded-secret/SKILL.md) | **block** |
|
|
18
|
+
| Instructions to POST data to a collection service | [`skills/exfil-url`](tests/fixtures/preinstall/skills/exfil-url/SKILL.md) | **block** |
|
|
19
|
+
| `curl … \| bash` installers | [`skills/curl-bash-installer`](tests/fixtures/preinstall/skills/curl-bash-installer/SKILL.md) | warn |
|
|
20
|
+
| …and leaves a plain skill alone | [`skills/clean`](tests/fixtures/preinstall/skills/clean/SKILL.md) | allow |
|
|
21
|
+
|
|
22
|
+
## MCP servers: how they're launched (static, nothing is started)
|
|
23
|
+
|
|
24
|
+
| Claim: Mund catches… | Fixture | Verdict |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| A package scope imitating `@modelcontextprotocol` | [`scope-typosquat`](tests/fixtures/preinstall/mcp-config/scope-typosquat.json) | **block** |
|
|
27
|
+
| A server URL pointing at a data-collection service | [`exfil-service-url`](tests/fixtures/preinstall/mcp-config/exfil-service-url.json) | **block** |
|
|
28
|
+
| A package name within two edits of a known server (`githbu`) | [`name-typosquat`](tests/fixtures/preinstall/mcp-config/name-typosquat.json) | warn |
|
|
29
|
+
| A remote server over plain HTTP | [`plain-http-remote`](tests/fixtures/preinstall/mcp-config/plain-http-remote.json) | warn |
|
|
30
|
+
| A token written into the config instead of `${ENV_VAR}` | [`inline-token`](tests/fixtures/preinstall/mcp-config/inline-token.json) | warn |
|
|
31
|
+
| A launcher that pipes a download into a shell | [`shell-pipeline-launcher`](tests/fixtures/preinstall/mcp-config/shell-pipeline-launcher.json) | warn |
|
|
32
|
+
| An unpinned package (flagged, low severity) | [`unpinned-package`](tests/fixtures/preinstall/mcp-config/unpinned-package.json) | allow |
|
|
33
|
+
| …and accepts `${ENV_VAR}` references and pinned official packages | [`env-reference`](tests/fixtures/preinstall/mcp-config/env-reference.json), [`clean-pinned`](tests/fixtures/preinstall/mcp-config/clean-pinned.json) | allow |
|
|
34
|
+
|
|
35
|
+
## MCP servers: live checks and rug pulls
|
|
36
|
+
|
|
37
|
+
Tested against a local fake MCP server ([`fake-mcp-server.mjs`](tests/fixtures/preinstall/fake-mcp-server.mjs)) in [`tests/preinstall.test.ts`](tests/preinstall.test.ts) and [`tests/fixtures/rugpull/`](tests/fixtures/rugpull):
|
|
38
|
+
|
|
39
|
+
| Claim | Verdict |
|
|
40
|
+
|---|---|
|
|
41
|
+
| A tool description that changes after approval (a rug pull) is flagged until you accept it | warn |
|
|
42
|
+
| A rug pull that adds a command-execution tool | **block** |
|
|
43
|
+
| Mund never starts a project server you haven't approved; it checks it statically | — |
|
|
44
|
+
| Mund never starts a server whose package or URL it already distrusts | — |
|
|
45
|
+
|
|
46
|
+
## Limits
|
|
47
|
+
|
|
48
|
+
Detection is pattern-based. These claims cover the attack shapes listed, not every variant: a paraphrased instruction with no hidden characters, URL or secret won't be caught by these checks. See the [OWASP coverage tables](README.md#️-owasp-coverage) for what is and isn't covered.
|
package/README.md
CHANGED
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
Mund (Old English: "protection, guardian") is a real-time security scanner for AI agent systems. It detects prompt injection, secrets, PII, dangerous code patterns, and data exfiltration attempts.
|
|
11
11
|
|
|
12
|
-
**🆕 New in v0.
|
|
12
|
+
**🆕 New in v0.3.1:** [Canary tokens](#-canary-tokens-system-prompt-leakage) catch leaked system prompts, and [rug-pull detection](#rug-pull-detection) flags MCP servers whose tools change after you approved them.
|
|
13
|
+
|
|
14
|
+
**v0.3.0:** `mund-mcp scan` scans files on disk and outputs text, JSON, or **SARIF for GitHub code scanning**. It checks npm dependencies against **OSV.dev**, with an offline cache. Every scan gets a **0–100 risk score**, and the README adds [OWASP coverage tables](#️-owasp-coverage). This release also fixes 23 secret rules that had never matched anything.
|
|
15
|
+
|
|
16
|
+
**v0.2.0:** Automated threat intelligence with MITRE ATT&CK mapping and community feeds.
|
|
13
17
|
|
|
14
18
|
## ✨ Features
|
|
15
19
|
|
|
@@ -314,6 +318,59 @@ Output: {
|
|
|
314
318
|
|
|
315
319
|
---
|
|
316
320
|
|
|
321
|
+
### Rug-Pull Detection
|
|
322
|
+
|
|
323
|
+
A rug pull is an MCP server that passes review at install time and then changes what its tools say or do. `mund_check_mcp_rugpull` records a fingerprint of every tool the first time it sees a server, then diffs every later manifest against it:
|
|
324
|
+
|
|
325
|
+
| Change | Severity |
|
|
326
|
+
|--------|----------|
|
|
327
|
+
| Tool description changed | high |
|
|
328
|
+
| Tool input schema changed | medium |
|
|
329
|
+
| Tool added | medium |
|
|
330
|
+
| Tool removed | low |
|
|
331
|
+
| Server renamed | high |
|
|
332
|
+
| Any of the above, where the changed tool now trips the MCP analyzer or newly asks for command execution | **critical** (`DO_NOT_USE`) |
|
|
333
|
+
|
|
334
|
+
Re-check servers on startup or on a schedule. After a human reviews a change, pass `accept_changes: true` to update the baseline. Baselines are stored in `~/.config/mund/mcp-baselines.json` (override with `MUND_BASELINE_PATH`).
|
|
335
|
+
|
|
336
|
+
## 🚪 Pre-Install Checks for Skills and MCP Servers
|
|
337
|
+
|
|
338
|
+
Mund checks agent skills and MCP servers **before they get to act**. Every check is backed by a fixture; see [DETECTION_CLAIMS.md](DETECTION_CLAIMS.md).
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
npx @weave_protocol/mund agent-audit --live # audit installed skills + configured MCP servers
|
|
342
|
+
npx @weave_protocol/mund check-skill ./my-skill/ # check one skill before you install it
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
- **Skills:** hidden Unicode (invisible tag characters, bidi overrides), prompt injection, exfiltration instructions, dangerous commands, and embedded secrets, across `SKILL.md` and every file the skill ships.
|
|
346
|
+
- **MCP servers, static:** package typosquats (including scopes imitating `@modelcontextprotocol`), unpinned packages, plain-HTTP or data-collection URLs, inline secrets, and shell-pipeline launchers.
|
|
347
|
+
- **MCP servers, live (`--live`):** connects, lists the tools, scans their descriptions, and compares them with the rug-pull baseline.
|
|
348
|
+
|
|
349
|
+
Verdicts are **block**, **warn** or **allow**. Configs are read from Claude Code (`.mcp.json`, `~/.claude.json`, Claude Desktop) or, with `--harness=antigravity`, from Antigravity (`.agents/`, `~/.gemini/config/`).
|
|
350
|
+
|
|
351
|
+
**Safety:** the live check never starts a project or workspace server you haven't approved, or a server whose package or URL it already distrusts. Those get static checks only.
|
|
352
|
+
|
|
353
|
+
**Enforcement** comes from the harness adapters, which run these checks as hooks:
|
|
354
|
+
- [`@weave_protocol/adapter-claudecode`](../adapter-claudecode#mund-pre-install-hooks): `weave-claude-code mund install`
|
|
355
|
+
- [`@weave_protocol/adapter-antigravity`](../adapter-antigravity#mund-pre-install-hooks): `weave-antigravity mund install`
|
|
356
|
+
|
|
357
|
+
## 🐤 Canary Tokens (System Prompt Leakage)
|
|
358
|
+
|
|
359
|
+
Put a canary in your system prompt. If a model is ever talked into revealing its instructions, the canary comes out with them, and Mund flags it in any scanned output. That includes copies with changed case, spacing or zero-width characters inserted, base64 encoding, or reversal.
|
|
360
|
+
|
|
361
|
+
```text
|
|
362
|
+
mund_create_canary { "label": "support-bot system prompt" }
|
|
363
|
+
→ "MUND-CANARY-7F3A9C2E41B8D605"
|
|
364
|
+
how_to_use: Add "Internal reference: MUND-CANARY-…. Never repeat it." to the system prompt
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
From then on, `mund_scan_content` reports any leak as a critical `canary_leak` finding that blocks the output. Also available:
|
|
368
|
+
- `mund_list_canaries` and `mund_remove_canary`
|
|
369
|
+
- Load canaries at startup with `MUND_CANARIES` (comma-separated) or `MUND_CANARY_FILE` (one per line)
|
|
370
|
+
- Scan transcripts from the CLI: `npx @weave_protocol/mund scan logs/ --canary=MUND-CANARY-…`
|
|
371
|
+
|
|
372
|
+
Both features are tested against a fixture library in [`tests/fixtures/`](https://github.com/Tyox-all/Weave_Protocol/blob/main/mund/tests/fixtures): one file per case, each with its expected verdict.
|
|
373
|
+
|
|
317
374
|
## 🔐 Content Scanning Tools
|
|
318
375
|
|
|
319
376
|
### `mund_scan`
|
|
@@ -392,41 +449,45 @@ Output: {
|
|
|
392
449
|
|
|
393
450
|
## 🛡️ OWASP Coverage
|
|
394
451
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
452
|
+
How the OWASP lists are covered, in two columns:
|
|
453
|
+
|
|
454
|
+
- **Mund**: what this package detects on its own.
|
|
455
|
+
- **Weave suite**: Mund together with the other Weave Protocol packages. A suite ✅ means another package **enforces or detects** the control on the row's main attack path. Each one was checked in that package's source, which is linked.
|
|
456
|
+
|
|
457
|
+
✅ = covered · 🟡 = partly covered (the gap is noted) · ⬜ = not covered · N/A = out of scope for agent security tooling.
|
|
458
|
+
Detection is pattern-based: it catches known shapes of an attack, not every variant.
|
|
400
459
|
|
|
401
460
|
### OWASP Top 10 for LLM Applications (2025)
|
|
402
461
|
|
|
403
|
-
| ID | Risk | Mund |
|
|
404
|
-
|
|
405
|
-
| LLM01 | Prompt Injection | 🟡 |
|
|
406
|
-
| LLM02 | Sensitive Information Disclosure | ✅ | 31 secret rules
|
|
407
|
-
| LLM03 | Supply Chain | 🟡 | OSV.dev
|
|
408
|
-
| LLM04 | Data and Model Poisoning |
|
|
409
|
-
| LLM05 | Improper Output Handling | 🟡 |
|
|
410
|
-
| LLM06 | Excessive Agency | 🟡 |
|
|
411
|
-
| LLM07 | System Prompt Leakage |
|
|
412
|
-
| LLM08 | Vector and Embedding Weaknesses | ⬜ | Not covered. |
|
|
413
|
-
| LLM09 | Misinformation |
|
|
414
|
-
| LLM10 | Unbounded Consumption | ⬜ |
|
|
462
|
+
| ID | Risk | Mund | Weave suite | Coverage and gaps |
|
|
463
|
+
|----|------|:----:|:-----------:|-------------------|
|
|
464
|
+
| LLM01 | Prompt Injection | 🟡 | 🟡 | Mund: 4 injection rules, MCP description/schema/resource injection, hidden Unicode. **Browser** adds DOM-aware IPI scanning, including hidden CSS text ([ipi.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/browser/src/ipi.ts)). Gap: paraphrased or novel injections can evade patterns. |
|
|
465
|
+
| LLM02 | Sensitive Information Disclosure | ✅ | ✅ | Mund: 31 secret rules, 5 PII rules, exfiltration patterns. **Hord** adds reversible PII tokenization and redaction ([redaction/engine.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/hord/src/redaction/engine.ts)). |
|
|
466
|
+
| LLM03 | Supply Chain | 🟡 | ✅ | Mund: OSV.dev CVEs for npm lockfiles, MCP typosquatting. **Tollere** covers npm, PyPI, Cargo, Go and Maven CVEs, typosquats, maintainer reputation, sandwich attacks, Docker images and IDE extensions ([cve.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/tollere/src/cve.ts), [sandwich.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/tollere/src/sandwich.ts), [docker.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/tollere/src/docker.ts)). Gap: no model or dataset provenance. |
|
|
467
|
+
| LLM04 | Data and Model Poisoning | N/A | N/A | Out of scope: training-time risk. |
|
|
468
|
+
| LLM05 | Improper Output Handling | 🟡 | ✅ | Mund: dangerous-code rules, `mund_validate_command`, `mund_check_url`. **Hundredmen** scans every tool call's arguments before execution and blocks or holds risky ones ([interceptor.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/hundredmen/src/interceptor.ts)). Gap: output rendered to a browser (XSS) isn't checked. |
|
|
469
|
+
| LLM06 | Excessive Agency | 🟡 | ✅ | **Hundredmen**: approve or block per call, auto-block of high-risk calls in strict mode, approval queues by category ([interceptor.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/hundredmen/src/interceptor.ts)). **Hord**: signed, expiring, scope-limited capability tokens with a delegation-depth cap ([capability/token.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/hord/src/capability/token.ts)). |
|
|
470
|
+
| LLM07 | System Prompt Leakage | ✅ | ✅ | Mund: **canary tokens** catch a leaked prompt in any scanned output, including spaced-out, zero-width, base64 and reversed copies ([canary.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/mund/src/canary.ts), [fixtures](https://github.com/Tyox-all/Weave_Protocol/blob/main/mund/tests/fixtures/canary)); it also flags extraction attempts and secrets inside prompts. Gap: a paraphrased leak that leaves out the canary isn't caught. |
|
|
471
|
+
| LLM08 | Vector and Embedding Weaknesses | ⬜ | ⬜ | Not covered. |
|
|
472
|
+
| LLM09 | Misinformation | N/A | N/A | Out of scope: content accuracy, not security. |
|
|
473
|
+
| LLM10 | Unbounded Consumption | ⬜ | ✅ | **Witan**: per-window USD, token and tool-call caps that block, require approval, or notify ([spending/tracker.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/witan/src/spending/tracker.ts)), plus rate-limit and quota policies ([policy.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/witan/src/policy.ts)). |
|
|
415
474
|
|
|
416
475
|
### OWASP Top 10 for Agentic Applications
|
|
417
476
|
|
|
418
|
-
| ID | Risk | Mund |
|
|
419
|
-
|
|
420
|
-
| ASI01 | Agent Goal Hijack | 🟡 |
|
|
421
|
-
| ASI02 | Tool Misuse and Exploitation | 🟡 |
|
|
422
|
-
| ASI03 | Identity and Privilege Abuse | 🟡 |
|
|
423
|
-
| ASI04 | Agentic Supply Chain Vulnerabilities |
|
|
424
|
-
| ASI05 | Unexpected Code Execution | 🟡 |
|
|
425
|
-
| ASI06 | Memory and Context Poisoning | 🟡 |
|
|
426
|
-
| ASI07 | Insecure Inter-Agent Communication | ⬜ |
|
|
427
|
-
| ASI08 | Cascading Failures | ⬜ |
|
|
428
|
-
| ASI09 | Human-Agent Trust Exploitation | ⬜ | Not covered. |
|
|
429
|
-
| ASI10 | Rogue Agents | ⬜ |
|
|
477
|
+
| ID | Risk | Mund | Weave suite | Coverage and gaps |
|
|
478
|
+
|----|------|:----:|:-----------:|-------------------|
|
|
479
|
+
| ASI01 | Agent Goal Hijack | 🟡 | 🟡 | Mund: injection and MCP tool-poisoning checks. **Hundredmen** and **Domere** flag drift from the declared intent ([thread/drift.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/domere/src/thread/drift.ts)). Gap: drift is scored by word overlap, not meaning, so a reworded hijack can pass. |
|
|
480
|
+
| ASI02 | Tool Misuse and Exploitation | 🟡 | ✅ | **Hundredmen** intercepts every MCP tool call: argument scanning, server reputation, intent analysis, then approve, block or hold for review ([interceptor.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/hundredmen/src/interceptor.ts)). |
|
|
481
|
+
| ASI03 | Identity and Privilege Abuse | 🟡 | ✅ | **Hord**: HMAC-signed capability tokens with expiry, revocation and a delegation-depth cap ([capability/token.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/hord/src/capability/token.ts)). **Domere**: signed handoff tokens bound to one agent, with expiry and revocation ([handoff/verification.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/domere/src/handoff/verification.ts)). Mund catches leaked credentials. |
|
|
482
|
+
| ASI04 | Agentic Supply Chain Vulnerabilities | ✅ | ✅ | Mund: static MCP manifest scanning, OSV CVEs, and **rug-pull detection**, which baselines every tool and escalates changes that turn malicious ([rugpull.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/mund/src/rugpull.ts), [fixtures](https://github.com/Tyox-all/Weave_Protocol/blob/main/mund/tests/fixtures/rugpull)). **Tollere**: package, container and extension supply chain. |
|
|
483
|
+
| ASI05 | Unexpected Code Execution | 🟡 | 🟡 | Mund: dangerous-code rules and command validation. **Hundredmen** can block or hold execution calls. Gap: **Hord**'s sandbox enforces a timeout and a temp working directory, but not memory, network or filesystem isolation ([sandbox/executor.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/hord/src/sandbox/executor.ts)). |
|
|
484
|
+
| ASI06 | Memory and Context Poisoning | 🟡 | 🟡 | Mund scans content before it enters context, and **Hord** stores memory encrypted. Gap: stored memory isn't scanned on write or integrity-checked. |
|
|
485
|
+
| ASI07 | Insecure Inter-Agent Communication | ⬜ | ✅ | **Domere**: handoffs carry a signed token with an intent hash, are bound to the receiving agent, and expire or can be revoked ([handoff/verification.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/domere/src/handoff/verification.ts)). |
|
|
486
|
+
| ASI08 | Cascading Failures | ⬜ | 🟡 | **Witan**: checkpoints, transaction rollback and recovery plans ([recovery.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/witan/src/recovery.ts)). Gap: recovers after failure; no circuit breaker to contain one. |
|
|
487
|
+
| ASI09 | Human-Agent Trust Exploitation | ⬜ | ⬜ | Not covered. |
|
|
488
|
+
| ASI10 | Rogue Agents | ⬜ | 🟡 | **Hord**: signed, hash-chained attestations of agent actions ([attestation/service.ts](https://github.com/Tyox-all/Weave_Protocol/blob/main/hord/src/attestation/service.ts)). **Hundredmen** monitors and can block calls. Gap: no behavioral baseline to spot a rogue agent automatically. |
|
|
489
|
+
|
|
490
|
+
**Totals:** Mund alone has **3 ✅** out of 20; the Weave suite has **10 ✅**. Next on the path to more green: injection detection measured against Adversary's corpus (LLM01 / ASI01), real sandbox isolation in Hord (ASI05), and scanning memory on write (ASI06).
|
|
430
491
|
|
|
431
492
|
---
|
|
432
493
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mund - The Guardian Protocol
|
|
3
|
+
* Agent audit: pre-install checks for skills and MCP servers
|
|
4
|
+
*
|
|
5
|
+
* Backs the "pre-install" hooks in the Weave Protocol harness adapters:
|
|
6
|
+
*
|
|
7
|
+
* - Skills: scan SKILL.md and every text file in a skill directory for
|
|
8
|
+
* prompt injection, exfiltration, dangerous code, secrets and hidden
|
|
9
|
+
* Unicode (invisible "tag" characters can smuggle instructions that a
|
|
10
|
+
* human reviewer never sees).
|
|
11
|
+
* - MCP servers: static checks on how each configured server is launched
|
|
12
|
+
* (package typosquats, unpinned packages, insecure or exfil URLs, inline
|
|
13
|
+
* secrets), plus an optional live check that connects, lists the tools,
|
|
14
|
+
* scans their descriptions, and compares them with the rug-pull baseline.
|
|
15
|
+
*
|
|
16
|
+
* SAFETY: the live check starts server processes. It only does that for
|
|
17
|
+
* servers the user configured themselves (user/local scope) or explicitly
|
|
18
|
+
* approved for this project. Project `.mcp.json` servers that Claude Code
|
|
19
|
+
* would still ask about are checked statically only, so opening a
|
|
20
|
+
* malicious repository never runs its servers through Mund.
|
|
21
|
+
*/
|
|
22
|
+
import type { SecurityIssue } from './types.js';
|
|
23
|
+
import { type McpServerManifest } from './analyzers/mcp-server-analyzer.js';
|
|
24
|
+
import { type RiskScore } from './scoring.js';
|
|
25
|
+
import { BaselineStore, type RugPullResult } from './rugpull.js';
|
|
26
|
+
export type Verdict = 'allow' | 'warn' | 'block';
|
|
27
|
+
/** Which agent harness's config layout to audit. */
|
|
28
|
+
export type Harness = 'claude' | 'antigravity';
|
|
29
|
+
export interface SkillAudit {
|
|
30
|
+
name: string;
|
|
31
|
+
path: string;
|
|
32
|
+
scope: 'project' | 'user' | 'workspace' | 'global' | 'plugin';
|
|
33
|
+
verdict: Verdict;
|
|
34
|
+
risk: RiskScore;
|
|
35
|
+
issues: SecurityIssue[];
|
|
36
|
+
}
|
|
37
|
+
export interface McpServerConfig {
|
|
38
|
+
type?: string;
|
|
39
|
+
command?: string;
|
|
40
|
+
args?: string[];
|
|
41
|
+
env?: Record<string, string>;
|
|
42
|
+
url?: string;
|
|
43
|
+
/** Antigravity spelling of url */
|
|
44
|
+
serverUrl?: string;
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface McpServerAudit {
|
|
49
|
+
name: string;
|
|
50
|
+
scope: 'project' | 'local' | 'user' | 'desktop' | 'workspace' | 'global';
|
|
51
|
+
transport: 'stdio' | 'http' | 'sse' | 'unknown';
|
|
52
|
+
target: string;
|
|
53
|
+
verdict: Verdict;
|
|
54
|
+
risk: RiskScore;
|
|
55
|
+
issues: SecurityIssue[];
|
|
56
|
+
live: {
|
|
57
|
+
status: 'ok' | 'error' | 'skipped';
|
|
58
|
+
reason?: string;
|
|
59
|
+
tools?: number;
|
|
60
|
+
rugpull?: RugPullResult['status'];
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface AgentAuditReport {
|
|
64
|
+
version: 1;
|
|
65
|
+
tool: {
|
|
66
|
+
name: 'mund';
|
|
67
|
+
version: string;
|
|
68
|
+
};
|
|
69
|
+
generatedAt: string;
|
|
70
|
+
cwd: string;
|
|
71
|
+
servers: McpServerAudit[];
|
|
72
|
+
skills: SkillAudit[];
|
|
73
|
+
summary: Record<Verdict, number>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* critical → block; high in a blocking category (injection, exfiltration,
|
|
77
|
+
* hidden Unicode) → block; other high/medium → warn; else allow.
|
|
78
|
+
*/
|
|
79
|
+
export declare function verdictFor(issues: Array<Pick<SecurityIssue, 'severity' | 'type'>>): Verdict;
|
|
80
|
+
/** Scan one piece of skill content (a SKILL.md or a file shipped with the skill). */
|
|
81
|
+
export declare function scanSkillContent(content: string): Promise<SecurityIssue[]>;
|
|
82
|
+
export declare function scanSkillDir(dir: string, scope?: SkillAudit['scope']): Promise<SkillAudit>;
|
|
83
|
+
export declare function skillRoots(cwd: string, home?: string, harness?: Harness): Array<[string, SkillAudit['scope']]>;
|
|
84
|
+
export declare function discoverSkillDirs(cwd: string, home?: string, harness?: Harness): Array<{
|
|
85
|
+
dir: string;
|
|
86
|
+
scope: SkillAudit['scope'];
|
|
87
|
+
}>;
|
|
88
|
+
interface DiscoveredServer {
|
|
89
|
+
name: string;
|
|
90
|
+
scope: McpServerAudit['scope'];
|
|
91
|
+
config: McpServerConfig;
|
|
92
|
+
/** Started by the user's own configuration or explicitly approved; safe to start for a live check. */
|
|
93
|
+
approved: boolean;
|
|
94
|
+
}
|
|
95
|
+
/** Claude Desktop's config, which also supplies MCP servers to its Code tab. */
|
|
96
|
+
export declare function claudeDesktopConfigPath(home?: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* Claude Code MCP config: <cwd>/.mcp.json (project), ~/.claude.json (user +
|
|
99
|
+
* per-project local), and Claude Desktop's claude_desktop_config.json.
|
|
100
|
+
*/
|
|
101
|
+
export declare function discoverMcpServers(cwd: string, home?: string): DiscoveredServer[];
|
|
102
|
+
/**
|
|
103
|
+
* Antigravity MCP config: <workspace>/.agents/mcp_config.json and
|
|
104
|
+
* ~/.gemini/config/mcp_config.json. Workspace servers are checked
|
|
105
|
+
* statically only (same consent rule as Claude Code project servers);
|
|
106
|
+
* servers marked "disabled" are never started.
|
|
107
|
+
*/
|
|
108
|
+
export declare function discoverAntigravityMcpServers(cwd: string, home?: string): DiscoveredServer[];
|
|
109
|
+
/** The package a launcher like `npx -y pkg@1.2.3` runs, if any. */
|
|
110
|
+
export declare function launchedPackage(config: McpServerConfig): {
|
|
111
|
+
name: string;
|
|
112
|
+
version?: string;
|
|
113
|
+
} | null;
|
|
114
|
+
/** Static checks on how a server is launched. No processes are started. */
|
|
115
|
+
export declare function checkMcpServerConfig(name: string, config: McpServerConfig): Promise<SecurityIssue[]>;
|
|
116
|
+
/** Connect to a server, list its tools, and return them as a manifest. */
|
|
117
|
+
export declare function fetchLiveManifest(name: string, config: McpServerConfig, timeoutMs?: number): Promise<McpServerManifest>;
|
|
118
|
+
export declare function calibrateLiveFindings(issues: SecurityIssue[]): SecurityIssue[];
|
|
119
|
+
export declare function auditMcpServer(server: DiscoveredServer, opts?: {
|
|
120
|
+
live?: boolean;
|
|
121
|
+
store?: BaselineStore;
|
|
122
|
+
timeoutMs?: number;
|
|
123
|
+
accept?: string[];
|
|
124
|
+
harness?: Harness;
|
|
125
|
+
}): Promise<McpServerAudit>;
|
|
126
|
+
/** Cache key: sha256(resolved cwd), plus the harness for non-Claude layouts. */
|
|
127
|
+
export declare function auditCachePath(cwd: string, harness?: Harness): string;
|
|
128
|
+
export declare function runAgentAudit(opts?: {
|
|
129
|
+
cwd?: string;
|
|
130
|
+
live?: boolean;
|
|
131
|
+
home?: string;
|
|
132
|
+
store?: BaselineStore;
|
|
133
|
+
timeoutMs?: number;
|
|
134
|
+
writeCache?: boolean;
|
|
135
|
+
accept?: string[];
|
|
136
|
+
harness?: Harness;
|
|
137
|
+
}): Promise<AgentAuditReport>;
|
|
138
|
+
export {};
|
|
139
|
+
//# sourceMappingURL=agent-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-audit.d.ts","sourceRoot":"","sources":["../src/agent-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,YAAY,CAAC;AAI1D,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,oCAAo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