@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,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,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,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,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,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,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,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
|
+
});
|