@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.
Files changed (116) hide show
  1. package/DETECTION_CLAIMS.md +48 -0
  2. package/README.md +91 -30
  3. package/dist/agent-audit.d.ts +139 -0
  4. package/dist/agent-audit.d.ts.map +1 -0
  5. package/dist/agent-audit.js +424 -0
  6. package/dist/agent-audit.js.map +1 -0
  7. package/dist/analyzers/index.d.ts.map +1 -1
  8. package/dist/analyzers/index.js +3 -1
  9. package/dist/analyzers/index.js.map +1 -1
  10. package/dist/analyzers/mcp-server-analyzer.d.ts.map +1 -1
  11. package/dist/analyzers/mcp-server-analyzer.js +4 -0
  12. package/dist/analyzers/mcp-server-analyzer.js.map +1 -1
  13. package/dist/canary.d.ts +48 -0
  14. package/dist/canary.d.ts.map +1 -0
  15. package/dist/canary.js +149 -0
  16. package/dist/canary.js.map +1 -0
  17. package/dist/cli/agent.d.ts +9 -0
  18. package/dist/cli/agent.d.ts.map +1 -0
  19. package/dist/cli/agent.js +91 -0
  20. package/dist/cli/agent.js.map +1 -0
  21. package/dist/cli/scan.d.ts +2 -1
  22. package/dist/cli/scan.d.ts.map +1 -1
  23. package/dist/cli/scan.js +10 -1
  24. package/dist/cli/scan.js.map +1 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +11 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/rugpull.d.ts +79 -0
  29. package/dist/rugpull.d.ts.map +1 -0
  30. package/dist/rugpull.js +190 -0
  31. package/dist/rugpull.js.map +1 -0
  32. package/dist/tools/canary-rugpull.d.ts +7 -0
  33. package/dist/tools/canary-rugpull.d.ts.map +1 -0
  34. package/dist/tools/canary-rugpull.js +50 -0
  35. package/dist/tools/canary-rugpull.js.map +1 -0
  36. package/dist/tools/index.d.ts +1 -0
  37. package/dist/tools/index.d.ts.map +1 -1
  38. package/dist/tools/index.js +4 -0
  39. package/dist/tools/index.js.map +1 -1
  40. package/dist/tools/monitoring.js +2 -2
  41. package/dist/tools/monitoring.js.map +1 -1
  42. package/package.json +1 -1
  43. package/src/agent-audit.ts +499 -0
  44. package/src/analyzers/index.ts +3 -1
  45. package/src/analyzers/mcp-server-analyzer.ts +3 -0
  46. package/src/canary.ts +165 -0
  47. package/src/cli/agent.ts +80 -0
  48. package/src/cli/scan.ts +10 -1
  49. package/src/index.ts +11 -0
  50. package/src/rugpull.ts +247 -0
  51. package/src/tools/canary-rugpull.ts +75 -0
  52. package/src/tools/index.ts +5 -0
  53. package/src/tools/monitoring.ts +2 -2
  54. package/tests/analyzers/engine.test.ts +1 -1
  55. package/tests/analyzers/mcp-server-analyzer.test.ts +1 -3
  56. package/tests/canary.test.ts +79 -0
  57. package/tests/cli/scan.test.ts +2 -2
  58. package/tests/fixtures/canary/base64.json +9 -0
  59. package/tests/fixtures/canary/clean-output.json +8 -0
  60. package/tests/fixtures/canary/exact-leak.json +9 -0
  61. package/tests/fixtures/canary/lowercased.json +9 -0
  62. package/tests/fixtures/canary/other-token.json +8 -0
  63. package/tests/fixtures/canary/prefix-only.json +8 -0
  64. package/tests/fixtures/canary/reversed.json +9 -0
  65. package/tests/fixtures/canary/spaced-out.json +9 -0
  66. package/tests/fixtures/canary/zero-width.json +9 -0
  67. package/tests/fixtures/preinstall/fake-mcp-server.mjs +8 -0
  68. package/tests/fixtures/preinstall/mcp-config/clean-pinned.json +13 -0
  69. package/tests/fixtures/preinstall/mcp-config/env-reference.json +15 -0
  70. package/tests/fixtures/preinstall/mcp-config/exfil-service-url.json +10 -0
  71. package/tests/fixtures/preinstall/mcp-config/inline-token.json +16 -0
  72. package/tests/fixtures/preinstall/mcp-config/name-typosquat.json +13 -0
  73. package/tests/fixtures/preinstall/mcp-config/plain-http-remote.json +10 -0
  74. package/tests/fixtures/preinstall/mcp-config/scope-typosquat.json +13 -0
  75. package/tests/fixtures/preinstall/mcp-config/shell-pipeline-launcher.json +13 -0
  76. package/tests/fixtures/preinstall/mcp-config/unpinned-package.json +14 -0
  77. package/tests/fixtures/preinstall/skills/bidi-override/SKILL.md +6 -0
  78. package/tests/fixtures/preinstall/skills/bidi-override/expected.json +4 -0
  79. package/tests/fixtures/preinstall/skills/clean/SKILL.md +6 -0
  80. package/tests/fixtures/preinstall/skills/clean/expected.json +3 -0
  81. package/tests/fixtures/preinstall/skills/curl-bash-installer/SKILL.md +6 -0
  82. package/tests/fixtures/preinstall/skills/curl-bash-installer/expected.json +4 -0
  83. package/tests/fixtures/preinstall/skills/embedded-secret/SKILL.md +6 -0
  84. package/tests/fixtures/preinstall/skills/embedded-secret/expected.json +4 -0
  85. package/tests/fixtures/preinstall/skills/exfil-url/SKILL.md +6 -0
  86. package/tests/fixtures/preinstall/skills/exfil-url/expected.json +4 -0
  87. package/tests/fixtures/preinstall/skills/hidden-tag-characters/SKILL.md +6 -0
  88. package/tests/fixtures/preinstall/skills/hidden-tag-characters/expected.json +4 -0
  89. package/tests/fixtures/rugpull/description-changed/baseline.json +36 -0
  90. package/tests/fixtures/rugpull/description-changed/current.json +36 -0
  91. package/tests/fixtures/rugpull/description-changed/expected.json +11 -0
  92. package/tests/fixtures/rugpull/gains-execution/baseline.json +36 -0
  93. package/tests/fixtures/rugpull/gains-execution/current.json +36 -0
  94. package/tests/fixtures/rugpull/gains-execution/expected.json +18 -0
  95. package/tests/fixtures/rugpull/schema-changed/baseline.json +36 -0
  96. package/tests/fixtures/rugpull/schema-changed/current.json +39 -0
  97. package/tests/fixtures/rugpull/schema-changed/expected.json +11 -0
  98. package/tests/fixtures/rugpull/schema-key-reorder/baseline.json +36 -0
  99. package/tests/fixtures/rugpull/schema-key-reorder/current.json +36 -0
  100. package/tests/fixtures/rugpull/schema-key-reorder/expected.json +5 -0
  101. package/tests/fixtures/rugpull/server-renamed/baseline.json +36 -0
  102. package/tests/fixtures/rugpull/server-renamed/current.json +36 -0
  103. package/tests/fixtures/rugpull/server-renamed/expected.json +11 -0
  104. package/tests/fixtures/rugpull/tool-added/baseline.json +36 -0
  105. package/tests/fixtures/rugpull/tool-added/current.json +44 -0
  106. package/tests/fixtures/rugpull/tool-added/expected.json +11 -0
  107. package/tests/fixtures/rugpull/tool-removed/baseline.json +36 -0
  108. package/tests/fixtures/rugpull/tool-removed/current.json +21 -0
  109. package/tests/fixtures/rugpull/tool-removed/expected.json +11 -0
  110. package/tests/fixtures/rugpull/unchanged/baseline.json +36 -0
  111. package/tests/fixtures/rugpull/unchanged/current.json +36 -0
  112. package/tests/fixtures/rugpull/unchanged/expected.json +5 -0
  113. package/tests/fixtures.test.ts +40 -0
  114. package/tests/preinstall.test.ts +153 -0
  115. package/tests/rugpull.test.ts +80 -0
  116. package/tests/tools/canary-rugpull.test.ts +57 -0
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ },
14
+ "units": {
15
+ "type": "string"
16
+ }
17
+ },
18
+ "required": [
19
+ "city"
20
+ ]
21
+ }
22
+ },
23
+ {
24
+ "name": "read_note",
25
+ "description": "Read a saved note by its title.",
26
+ "inputSchema": {
27
+ "type": "object",
28
+ "properties": {
29
+ "title": {
30
+ "type": "string"
31
+ }
32
+ },
33
+ "required": [
34
+ "title"
35
+ ]
36
+ }
37
+ }
38
+ ]
39
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "description": "New optional parameter added",
3
+ "status": "changed",
4
+ "changes": [
5
+ {
6
+ "kind": "schema_changed",
7
+ "tool": "get_weather",
8
+ "severity": "medium"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "required": [
10
+ "city"
11
+ ],
12
+ "properties": {
13
+ "city": {
14
+ "type": "string"
15
+ }
16
+ },
17
+ "type": "object"
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "description": "Same schema, keys in a different order",
3
+ "status": "unchanged",
4
+ "changes": []
5
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "weather-notes-pro",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "description": "Server renamed after approval",
3
+ "status": "changed",
4
+ "changes": [
5
+ {
6
+ "kind": "server_renamed",
7
+ "tool": "*",
8
+ "severity": "high"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ },
35
+ {
36
+ "name": "list_notes",
37
+ "description": "List the titles of saved notes.",
38
+ "inputSchema": {
39
+ "type": "object",
40
+ "properties": {}
41
+ }
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "description": "A new tool appears",
3
+ "status": "changed",
4
+ "changes": [
5
+ {
6
+ "kind": "tool_added",
7
+ "tool": "list_notes",
8
+ "severity": "medium"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "description": "A tool disappears",
3
+ "status": "changed",
4
+ "changes": [
5
+ {
6
+ "kind": "tool_removed",
7
+ "tool": "read_note",
8
+ "severity": "low"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "weather-notes",
3
+ "version": "1.0.0",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the current weather for a city.",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ }
19
+ },
20
+ {
21
+ "name": "read_note",
22
+ "description": "Read a saved note by its title.",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "title": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "title"
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "description": "Same manifest re-checked",
3
+ "status": "unchanged",
4
+ "changes": []
5
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Fixture library: one fixture per case, each with its expected verdict.
3
+ * Add a file/folder under tests/fixtures/ and it is picked up here.
4
+ */
5
+ import { readdirSync, readFileSync } from 'fs';
6
+ import { join } from 'path';
7
+ import { describe, expect, it } from 'vitest';
8
+ import { CanaryRegistry } from '../src/canary.js';
9
+ import { diffManifest, fingerprintManifest } from '../src/rugpull.js';
10
+
11
+ const dir = (p: string) => join(__dirname, 'fixtures', p);
12
+ const json = (p: string) => JSON.parse(readFileSync(p, 'utf8'));
13
+
14
+ describe('canary fixtures', () => {
15
+ for (const file of readdirSync(dir('canary'))) {
16
+ const fx = json(join(dir('canary'), file));
17
+ it(`${file}: ${fx.description}`, () => {
18
+ const registry = new CanaryRegistry();
19
+ registry.register(fx.canary);
20
+ const hits = registry.find(fx.content);
21
+ expect(hits.length > 0).toBe(fx.expected.detected);
22
+ if (fx.expected.kind) expect(hits[0].kind).toBe(fx.expected.kind);
23
+ });
24
+ }
25
+ });
26
+
27
+ describe('rug-pull fixtures', () => {
28
+ for (const name of readdirSync(dir('rugpull'))) {
29
+ const base = join(dir('rugpull'), name);
30
+ const expected = json(join(base, 'expected.json'));
31
+ it(`${name}: ${expected.description}`, async () => {
32
+ const baseline = fingerprintManifest('fixture', json(join(base, 'baseline.json')));
33
+ const changes = await diffManifest(baseline, json(join(base, 'current.json')));
34
+ expect(changes.length > 0 ? 'changed' : 'unchanged').toBe(expected.status);
35
+ expect(changes.map(c => ({ kind: c.kind, tool: c.tool, severity: c.severity, ...(c.escalated ? { escalated: true } : {}) })))
36
+ .toEqual(expect.arrayContaining(expected.changes));
37
+ expect(changes).toHaveLength(expected.changes.length);
38
+ });
39
+ }
40
+ });