@misconfig/cli 1.1.0 → 1.3.1

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.
@@ -0,0 +1,587 @@
1
+ // What misconfig knows to be malicious, or to be missing security fixes,
2
+ // from public reports. It ships with each release and is checked on the
3
+ // computer, with no network requests. Add --lookup to also ask OSV.dev, which
4
+ // is updated every day. Every entry names its source, and only facts the
5
+ // source states are used.
6
+ //
7
+ // Shared and private reports repeat these words, and misconfig.ai accepts
8
+ // only words this file gives. When the wording of a fact changes after a
9
+ // release, keep the old wording in the entry's `was` (for example
10
+ // was: { what: ["..."] }), so reports made by earlier versions still open.
11
+
12
+ // The day the OSV.dev listings below were taken. misconfig.ai publishes the
13
+ // ones listed since (see addKnownMalware).
14
+ export const KNOWN_AS_OF = "2026-11-02";
15
+
16
+ // MCP packages OSV.dev lists as malware (IDs starting MAL-), as of
17
+ // KNOWN_AS_OF, with the versions each listing names, or "all". A package with a
18
+ // few versions listed is often a real one whose publishing account was taken
19
+ // over, so only those versions count against it.
20
+ const OSV_MALWARE = [
21
+ ["npm", "@ifasn/md-doc-mcp", "MAL-2026-18486", "1.0.3 1.0.4 1.0.5"],
22
+ ["npm", "@ifasn/mmd-doc-mcp", "MAL-2026-18488", "1.0.0 1.0.2"],
23
+ ["npm", "@ifasn/mmdd-doc-mcp", "MAL-2026-18489", "1.0.1 1.0.3 1.0.4 1.0.4-2 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9-2 2.0.1 2.0.4"],
24
+ ["npm", "@ifasn/mdd-doc-mcp", "MAL-2026-18487", "1.0.7 1.0.8 2.0.6"],
25
+ ["npm", "mcp-consultasdeveiculos-client", "MAL-2026-15869", "0.0.2 0.1.0 0.1.1"],
26
+ ["npm", "feishu-docx-mcp", "MAL-2026-16032", "all"],
27
+ ["npm", "@yongot/canary-mcp-isolation", "MAL-2026-16061", "1.0.0 1.0.1 1.0.2"],
28
+ ["npm", "@yongot/canary-mcp-test", "MAL-2026-16062", "1.0.0 2.0.0 3.0.0 4.0.0"],
29
+ ["npm", "mcp-real-chrome", "MAL-2026-14414", "all"],
30
+ ["npm", "homekit-mcp", "MAL-2026-14297", "1.0.0"],
31
+ ["npm", "code-assist-mcp", "MAL-2026-14233", "1.0.0"],
32
+ ["npm", "@httttt/mcp-demo", "MAL-2026-14315", "all"],
33
+ ["npm", "chrome-enterprise-premium-mcp", "MAL-2026-14230", "1.0.0"],
34
+ ["npm", "mcp-dev-toolkit", "MAL-2026-14295", "1.5.0"],
35
+ ["npm", "broadcast-graphics-mcp", "MAL-2026-14228", "1.0.0"],
36
+ ["npm", "fa-mcp-sdk", "MAL-2026-12789", "0.12.72"],
37
+ ["npm", "devplatform-react-mcp", "MAL-2026-13502", "35.5.6"],
38
+ ["npm", "agenthub-multiagent-mcp", "MAL-2026-13399", "1.57.0"],
39
+ ["npm", "xrblocks-mcp", "MAL-2026-13988", "6.3.1"],
40
+ ["npm", "mcp-util-helpers", "MAL-2026-13880", "1.0.0"],
41
+ ["npm", "@kolbo/mcp", "MAL-2026-13938", "1.57.1"],
42
+ ["npm", "mcp-audit-sync-internal", "MAL-2026-12401", "99.9.9"],
43
+ ["npm", "@or-sdk/mcp-tools", "MAL-2026-11713", "0.5.2 0.5.3 0.5.4"],
44
+ ["npm", "@servicetitan/anvil2-mcp", "MAL-2026-11829", "0.0.9 0.0.10 0.0.11 0.0.12 0.0.13 0.0.14 0.0.15"],
45
+ ["npm", "hit-mcp", "MAL-2026-11466", "1.0.0"],
46
+ ["npm", "@copilot-mcp/apex", "MAL-2026-12314", "1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.16 1.0.17 1.0.21 1.0.22"],
47
+ ["npm", "code-analyzer-mcp", "MAL-2026-12354", "1.0.0"],
48
+ ["npm", "iwomm-mcp", "MAL-2026-11469", "1.0.0"],
49
+ ["npm", "sap-mcp-facilitator", "MAL-2026-11482", "1.0.0"],
50
+ ["npm", "mcp-server-boilerplate", "MAL-2026-11472", "1.0.0"],
51
+ ["npm", "gtm-mcp-auth", "MAL-2026-11464", "1.0.0"],
52
+ ["npm", "refbase-mcp", "MAL-2026-11477", "1.0.0"],
53
+ ["npm", "chaos-mcp", "MAL-2026-11458", "1.0.0"],
54
+ ["npm", "maximumsats-mcp", "MAL-2026-11471", "1.0.0"],
55
+ ["npm", "kip-mcp-http", "MAL-2026-11470", "1.0.0"],
56
+ ["npm", "pm-claude-skills-mcp", "MAL-2026-11475", "1.0.0"],
57
+ ["npm", "smart-npv-mcp", "MAL-2026-11486", "1.0.0"],
58
+ ["npm", "routerbase-mcp", "MAL-2026-11480", "1.0.0"],
59
+ ["npm", "sap-mcp-config", "MAL-2026-11481", "1.0.0"],
60
+ ["npm", "@vite-mcp/vite-type", "MAL-2026-10525", "all"],
61
+ ["npm", "proxy-seller-mcp", "MAL-2026-10541", "0.1.7"],
62
+ ["npm", "sensorium-mcp", "MAL-2026-10747", "3.0.95"],
63
+ ["npm", "mcp-notes-server-poc-praetorian", "MAL-2026-10210", "all"],
64
+ ["npm", "sidecar-mcp", "MAL-2026-10161", "all"],
65
+ ["npm", "polymarket-mcp-v2", "MAL-2026-10481", "all"],
66
+ ["npm", "mcp-ci-runner-poc", "MAL-2026-7318", "1.0.0"],
67
+ ["npm", "cue-mcp", "MAL-2026-6294", "9999.99.99"],
68
+ ["npm", "zomato-mcp", "MAL-2026-6270", "1.0.0"],
69
+ ["npm", "@mastra/mcp-docs-server", "MAL-2026-5956", "1.1.47"],
70
+ ["npm", "@mastra/mcp-registry-registry", "MAL-2026-6027", "1.0.2"],
71
+ ["npm", "@mastra/mcp", "MAL-2026-5955", "1.10.1"],
72
+ ["npm", "mcp-server-pg", "MAL-2026-6922", "all"],
73
+ ["npm", "sp-api-dev-assistant-mcp-server", "MAL-2026-5853", "all"],
74
+ ["npm", "claude-token-tracker-mcp", "MAL-2026-10693", "all"],
75
+ ["npm", "mcp-server-git", "MAL-2026-5478", "all"],
76
+ ["npm", "mcp-server-fetch", "MAL-2026-5476", "all"],
77
+ ["npm", "mcp-server-postgres", "MAL-2026-5481", "all"],
78
+ ["npm", "mcp-server-redis", "MAL-2026-5482", "all"],
79
+ ["npm", "mcp-server-sequential-thinking", "MAL-2026-5484", "all"],
80
+ ["npm", "mcp-server-figma", "MAL-2026-5477", "all"],
81
+ ["npm", "mcp-server-notion", "MAL-2026-5480", "all"],
82
+ ["npm", "mcp-server-sentry", "MAL-2026-5483", "all"],
83
+ ["npm", "mcp-server-supabase", "MAL-2026-5485", "all"],
84
+ ["npm", "screenpipe-mcp-http", "MAL-2026-5402", "9999.99.99"],
85
+ ["npm", "create-docs-mcp", "MAL-2026-5397", "9999.99.99"],
86
+ ["npm", "t-invest-mcp-server", "MAL-2026-5403", "9999.99.99"],
87
+ ["npm", "autotel-mcp", "MAL-2026-5223", "0.1.14 2.0.1 3.0.1 4.0.1 5.0.1 6.0.1 7.0.1 8.0.1 9.0.1 10.0.1 11.0.1 13.0.1 14.0.1 15.0.2 16.0.1 17.0.2 18.0.1 19.0.1 20.0.1 21.1.1 22.0.1 23.0.1 24.0.1 25.0.1 26.0.2 27.0.1 28.0.3 29.0.1"],
88
+ ["npm", "autotel-mcp-instrumentation", "MAL-2026-5224", "29.0.2 30.0.5 31.0.1 32.0.1 33.0.2 34.0.1"],
89
+ ["npm", "executable-stories-mcp", "MAL-2026-5255", "0.3.3"],
90
+ ["npm", "brave-search-mcp-server", "MAL-2026-5182", "1.0.0"],
91
+ ["npm", "@redhat-cloud-services/hcc-feo-mcp", "MAL-2026-5129", "0.3.1 0.3.2 0.3.4"],
92
+ ["npm", "@redhat-cloud-services/hcc-kessel-mcp", "MAL-2026-5139", "0.3.1 0.3.2 0.3.4"],
93
+ ["npm", "@redhat-cloud-services/hcc-pf-mcp", "MAL-2026-5140", "0.6.1 0.6.2 0.6.4"],
94
+ ["npm", "@cloudplatform-single-spa/ml-ai-agents-mcp-server", "MAL-2026-4938", "all"],
95
+ ["npm", "explorhub-mcp-server", "MAL-2026-4312", "all"],
96
+ ["npm", "mcp-dashboards-shared", "MAL-2026-4296", "all"],
97
+ ["npm", "@djessicatony/folk-mcp-canary", "MAL-2026-4382", "0.0.1"],
98
+ ["npm", "bitrix24-tasks-mcp-server", "MAL-2026-4498", "1.1.0 1.2.0 1.4.0 1.5.0 1.5.1"],
99
+ ["npm", "bricks-builder-mcp", "MAL-2026-4500", "3.6.1 3.10.0 3.11.2 3.12.3"],
100
+ ["npm", "@antv/mcp-server-antv", "MAL-2026-4068", "0.2.8 0.3.8"],
101
+ ["npm", "@antv/mcp-server-chart", "MAL-2026-4069", "0.10.10 0.11.10"],
102
+ ["npm", "mcp-echarts", "MAL-2026-4146", "0.8.1 0.9.1"],
103
+ ["npm", "mcp-mermaid", "MAL-2026-4147", "0.5.1 0.6.1"],
104
+ ["npm", "nextmove-mcp", "MAL-2026-3589", "0.1.3 0.1.4 0.1.5 0.1.6 0.1.7"],
105
+ ["npm", "cmux-agent-mcp", "MAL-2026-3588", "0.1.3 0.1.4 0.1.5 0.1.6 0.1.7 0.1.8"],
106
+ ["npm", "@squawk/mcp", "MAL-2026-3448", "0.9.1 0.9.2 0.9.3 0.9.4 0.9.5"],
107
+ ["npm", "pi-exa-mcp", "MAL-2026-3280", "all"],
108
+ ["npm", "claudcode-mcp", "MAL-2026-2974", "all"],
109
+ ["npm", "mcp-server-todo", "MAL-2026-2328", "all"],
110
+ ["npm", "@iflow-mcp/watercrawl-watercrawl-mcp", "MAL-2026-1930", "1.3.0 1.3.1 1.3.2 1.3.3 1.3.4"],
111
+ ["npm", "@upstashed/context7-mcp", "MAL-2026-1642", "1.0.2"],
112
+ ["npm", "excluder-mcp", "MAL-2025-192746", "all"],
113
+ ["npm", "excluder-mcp-package", "MAL-2025-192747", "all"],
114
+ ["npm", "vscode-azure-mcp-server", "MAL-2025-192601", "all"],
115
+ ["npm", "solana-dev-mcp", "MAL-2025-191527", "all"],
116
+ ["npm", "mcp-polymarket", "MAL-2025-191465", "all"],
117
+ ["npm", "@browserbasehq/mcp-server-browserbase", "MAL-2025-191196", "2.4.2"],
118
+ ["npm", "@browserbasehq/mcp", "MAL-2025-191195", "all"],
119
+ ["npm", "@seezo/sdr-mcp-server", "MAL-2025-191053", "0.0.5"],
120
+ ["npm", "@relyt/mcp-server-relytone", "MAL-2025-191052", "all"],
121
+ ["npm", "@relyt/claude-context-mcp", "MAL-2025-191051", "all"],
122
+ ["npm", "ids-enterprise-mcp-server", "MAL-2025-191107", "0.0.2"],
123
+ ["npm", "web-scraper-mcp", "MAL-2025-190943", "1.1.4"],
124
+ ["npm", "@mcp-use/cli", "MAL-2025-190867", "2.2.6 2.2.7"],
125
+ ["npm", "@mcp-use/inspector", "MAL-2025-190868", "0.6.2 0.6.3"],
126
+ ["npm", "@mcp-use/mcp-use", "MAL-2025-190869", "1.0.1 1.0.2"],
127
+ ["npm", "@postman/mcp-ui-client", "MAL-2025-190902", "5.5.1 5.5.2 5.5.3"],
128
+ ["npm", "@postman/postman-mcp-cli", "MAL-2025-190908", "1.0.3 1.0.4 1.0.5"],
129
+ ["npm", "@postman/postman-mcp-server", "MAL-2025-190909", "2.4.10 2.4.11 2.4.12"],
130
+ ["npm", "@zapier/mcp-integration", "MAL-2025-190918", "3.0.1 3.0.2 3.0.3"],
131
+ ["npm", "create-mcp-use-app", "MAL-2025-190922", "0.5.3 0.5.4"],
132
+ ["npm", "mcp-use", "MAL-2025-190923", "1.4.2 1.4.3"],
133
+ ["npm", "lite-serper-mcp-server", "MAL-2025-190848", "all"],
134
+ ["npm", "rce-poc-test-honor-mcp", "MAL-2025-49383", "all"],
135
+ ["npm", "revenuecat-mcp-extension", "MAL-2025-49378", "all"],
136
+ ["npm", "demo-mercadopago-mcp-server", "MAL-2025-48558", "99.0.0 99.0.1 99.0.2 99.0.3 99.0.4 99.0.5"],
137
+ ["npm", "shiprocket-mcp", "MAL-2025-48761", "all"],
138
+ ["npm", "mcp-server-fixthis", "MAL-2025-47929", "all"],
139
+ ["npm", "mcp-knowledge-graph", "MAL-2025-47327", "1.2.1"],
140
+ ["npm", "mcp-knowledge-base", "MAL-2025-47326", "all"],
141
+ ["npm", "mcp-lumin", "MAL-2025-47076", "all"],
142
+ ["npm", "mcp-chat-client", "MAL-2025-47098", "all"],
143
+ ["npm", "mcp-server-everything", "MAL-2025-46986", "all"],
144
+ ["npm", "wealthsimple-mcp-server", "MAL-2025-42116", "all"],
145
+ ["npm", "auth0-mcp-server", "MAL-2025-15093", "all"],
146
+ ["npm", "mcp-menu", "MAL-2025-26053", "all"],
147
+ ["npm", "mcp-opencage-server", "MAL-2025-26054", "all"],
148
+ ["npm", "@jaswanthlanka/mcp-proxy", "MAL-2025-6139", "all"],
149
+ ["npm", "glean-mcp-server", "MAL-2025-5813", "all"],
150
+ ["npm", "rush-mcp-example-plugin", "MAL-2025-5286", "all"],
151
+ ["npm", "yaml-mcp-wrapper", "MAL-2025-4635", "all"],
152
+ ["PyPI", "marketing-mcp", "MAL-2026-16250", "0.1.0"],
153
+ ["PyPI", "mcp-search-server", "MAL-2026-11198", "1.0.0 2.0.0 2.0.1"],
154
+ ["PyPI", "openai-mcp", "MAL-2026-5320", "2.41.1 2.41.2"],
155
+ ["PyPI", "tiktoken-mcp", "MAL-2026-5326", "0.13.1 0.13.2"],
156
+ ["PyPI", "instructor-mcp", "MAL-2026-5317", "1.15.2 1.15.3"],
157
+ ["PyPI", "langchain-core-mcp", "MAL-2026-5318", "1.4.2 1.4.3"],
158
+ ["PyPI", "ray-mcp-server", "MAL-2026-5325", "0.2.1"],
159
+ ["PyPI", "docontrol-mcp", "MAL-2026-4811", "999.0.0"],
160
+ ["PyPI", "vulndify-mcp-server", "MAL-2026-4774", "0.3.0"],
161
+ ["PyPI", "ant-mcp-proxy-for-test", "MAL-2026-2669", "0.10.0"],
162
+ ["PyPI", "latinum-wallet-mcp", "MAL-2026-2315", "0.0.32 0.0.33 0.0.34 0.0.35 0.0.36"],
163
+ ["PyPI", "mcp-transport-proto", "MAL-2026-1990", "9.9.9"],
164
+ ["PyPI", "mcp-pdftool-plus", "MAL-2026-603", "0.1.3 0.1.4 0.1.5"],
165
+ ["PyPI", "mcp-weather-full", "MAL-2025-191789", "0.8.0 0.8.1 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.8.8 0.8.9 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5 0.9.6 1.0.0 1.0.1"],
166
+ ["PyPI", "mcp-runcmd-server", "MAL-2025-191788", "1.0 2.0"],
167
+ ["PyPI", "mcp-runcommand-server2", "MAL-2025-191648", "1.0.6"],
168
+ ["PyPI", "mcp-runcommand-server", "MAL-2025-191647", "1.0.5 1.0.7 1.0.8 1.0.9 1.0.10 1.0.11 1.0.12 1.0.13"],
169
+ ["PyPI", "groq-mcp", "MAL-2025-6007", "0.0.1 9.9.9"],
170
+ ["PyPI", "story-mcp-hub", "MAL-2025-3471", "9999.0.0"],
171
+ ["PyPI", "mcp-xyz", "MAL-2025-4223", "0.1.0"],
172
+ ];
173
+
174
+ // Packages, by "ecosystem:name". `versions` is "all" when every version is
175
+ // unsafe (including a copy that looks harmless), or the versions that were
176
+ // malware.
177
+ const listedPackage = (ref, versions, kind) =>
178
+ versions === "all"
179
+ ? { versions: "all", what: `${kind} listed as malware`, source: `OSV ${ref}` }
180
+ : { versions: versions.split(" "), what: `${kind} with versions listed as malware`, source: `OSV ${ref}` };
181
+ export const KNOWN_PACKAGES = {
182
+ ...Object.fromEntries(OSV_MALWARE.map(([ecosystem, name, ref, versions]) => [`${ecosystem}:${name}`, listedPackage(ref, versions, versions === "all" ? "an MCP server" : "an MCP package")])),
183
+ "npm:postmark-mcp": {
184
+ versions: "all",
185
+ what: "a copy of Postmark's MCP server published by someone else. From version 1.0.16 it secretly copied every email it sent to the publisher",
186
+ source: "Koi Security, September 2025",
187
+ was: { source: ["Dark Reading, September 2025"] },
188
+ },
189
+ "npm:@lanyer640/mcp-runcommand-server": {
190
+ versions: "all",
191
+ what: "an MCP server that, from version 1.0.6, opens a reverse shell to the attacker as soon as it's installed",
192
+ source: "Checkmarx, October 2025",
193
+ },
194
+ "npm:mcp-server-github": {
195
+ versions: "all",
196
+ what: "a lookalike of the official @modelcontextprotocol/server-github that reports details of every computer it's installed on",
197
+ source: "OSV MAL-2026-5479",
198
+ },
199
+ "npm:@atlisp/mcp": {
200
+ versions: ["1.12.14"],
201
+ what: "an MCP package whose version 1.12.14 is malware that can take over the computer",
202
+ source: "Helix threat watch, October 2026",
203
+ },
204
+ "npm:@revizahoshii/hoshino-mcp-server": { versions: "all", what: "an MCP server listed as malware", source: "OSV MAL-2026-17825" },
205
+ "npm:@httttt/mcp-npx-fetch-1": { versions: "all", what: "an MCP server listed as malware", source: "OSV MAL-2026-16422" },
206
+ "npm:ubiquiti-agents-link-mcp": { versions: "all", what: "an MCP server listed as malware", source: "OSV MAL-2026-16409" },
207
+ // The s1ngularity attack: malicious Nx releases that used installed AI
208
+ // agents (claude, gemini, q) with their safety flags off to hunt for secrets.
209
+ ...Object.fromEntries(
210
+ [
211
+ ["nx", ["20.9.0", "20.10.0", "20.11.0", "20.12.0", "21.5.0", "21.6.0", "21.7.0", "21.8.0"]],
212
+ ["@nx/devkit", ["20.9.0", "21.5.0"]],
213
+ ["@nx/js", ["20.9.0", "21.5.0"]],
214
+ ["@nx/node", ["20.9.0", "21.5.0"]],
215
+ ["@nx/workspace", ["20.9.0", "21.5.0"]],
216
+ ["@nx/eslint", ["21.5.0"]],
217
+ ["@nx/enterprise-cloud", ["3.2.0"]],
218
+ ["@nx/key", ["3.2.0"]],
219
+ ].map(([name, versions]) => [
220
+ `npm:${name}`,
221
+ {
222
+ versions,
223
+ what: "a release replaced with malware in the s1ngularity attack. It ran the AI agents on the computer with their safety checks off to find secrets, and published them",
224
+ source: "Nx advisory GHSA-cxm3-wv7p-598c",
225
+ },
226
+ ]),
227
+ ),
228
+ };
229
+
230
+ // Editor extensions, by lowercase "publisher.name". `editors` limits an entry
231
+ // to the editors whose marketplace served the bad build.
232
+ const GLASSWORM = {
233
+ versions: "all",
234
+ what: "one of the extensions in the GlassWorm campaign, which installs remote-access malware",
235
+ source: "The Hacker News, December 2025",
236
+ };
237
+ // Editors that install from Open VSX, and those that use Microsoft's
238
+ // marketplace. The same extension ID can belong to different publishers on
239
+ // each, so a listing for one doesn't apply to the other.
240
+ export const OPEN_VSX_EDITORS = ["VSCodium", "Cursor", "Windsurf", "Kiro"];
241
+ const MICROSOFT_EDITORS = ["VS Code", "VS Code Insiders"];
242
+ // Extensions OSV.dev lists as malware, as of November 2, 2026: ID, the
243
+ // marketplace it names, the listing, and the versions it names or "all".
244
+ const OSV_EXTENSIONS = [
245
+ ["azurecdninfo.edrtester", "microsoft", "MAL-2026-16010", "1.0.4"],
246
+ ["nrwl.angular-console", "both", "MAL-2026-5161", "18.95.0"],
247
+ ["checkmarx.ast-results", "open-vsx", "MAL-2026-2231", "2.35.0 2.36.0 2.37.0 2.38.0 2.39.0 2.40.0 2.42.0 2.43.0 2.44.0 2.45.0 2.46.0 2.47.0 2.48.0 2.49.0 2.49.1772191521 2.49.1772192163 2.50.0 2.51.0 2.52.0 2.53.0 2.56.0"],
248
+ ["checkmarx.cx-dev-assist", "open-vsx", "MAL-2026-2232", "1.1.0 1.2.0 1.3.0 1.3.1772191535 1.3.1772192178 1.4.0 1.5.0 1.6.0 1.7.0 1.10.0"],
249
+ ["aquasecurityofficial.trivy-vulnerability-scanner", "open-vsx", "MAL-2026-2230", "1.8.12 1.8.13"],
250
+ ["effetmer.darkgpt", "microsoft", "MAL-2025-192568", "all"],
251
+ ["cline-ai-main.cline-ai-agent", "microsoft", "MAL-2025-191157", "all"],
252
+ ["codeinklingon.git-worktree-menu", "open-vsx", "MAL-2025-191158", "all"],
253
+ ["codejoy.codejoy-vscode-extension", "open-vsx", "MAL-2025-191159", "all"],
254
+ ["ellacrity.recoil", "open-vsx", "MAL-2025-191160", "all"],
255
+ ["ginfuru.better-nunjucks", "open-vsx", "MAL-2025-191161", "all"],
256
+ ["grrrck.positron-plus-1-e", "open-vsx", "MAL-2025-191162", "all"],
257
+ ["jeronimoekerdt.color-picker-universal", "open-vsx", "MAL-2025-191163", "all"],
258
+ ["jscearcy.rust-doc-viewer", "open-vsx", "MAL-2025-191164", "all"],
259
+ ["kleinesfilmroellchen.serenity-dsl-syntaxhighlight", "open-vsx", "MAL-2025-191165", "all"],
260
+ ["l-igh-t.vscode-theme-seti-folder", "open-vsx", "MAL-2025-191166", "all"],
261
+ ["sirilmp.dark-theme-sm", "open-vsx", "MAL-2025-191167", "all"],
262
+ ["sissel.shopify-liquid", "open-vsx", "MAL-2025-191168", "all"],
263
+ ["srcery-colors.srcery-colors", "open-vsx", "MAL-2025-191169", "all"],
264
+ ["tretinv3.forts-api-extention", "open-vsx", "MAL-2025-191170", "all"],
265
+ ];
266
+ const listedExtension = (marketplace, ref, versions) => ({
267
+ versions: versions === "all" ? "all" : versions.split(" "),
268
+ ...(marketplace === "both" ? {} : { editors: marketplace === "open-vsx" ? OPEN_VSX_EDITORS : MICROSOFT_EDITORS }),
269
+ what: versions === "all" ? "an extension listed as malware" : "a release listed as malware",
270
+ source: `OSV ${ref}`,
271
+ });
272
+ export const KNOWN_EXTENSIONS = {
273
+ ...Object.fromEntries(OSV_EXTENSIONS.map(([id, marketplace, ref, versions]) => [id, listedExtension(marketplace, ref, versions)])),
274
+ "anthropic.claude-code": {
275
+ versions: ["2.1.312", "2.1.313"],
276
+ editors: ["Cursor"],
277
+ what: "a tampered build of the Claude Code extension that Cursor's marketplace served on October 29, 2026. It adds an SSH key to ~/.ssh/authorized_keys and opens a tunnel to the attacker",
278
+ source: "StepSecurity, October 2026",
279
+ advice: "Uninstall it, delete any key ending in svc-telemetry from ~/.ssh/authorized_keys, and follow Cursor's security notice for this extension",
280
+ },
281
+ ...Object.fromEntries(
282
+ [
283
+ "iconkieftwo.icon-theme-materiall",
284
+ "prisma-inc.prisma-studio-assistance",
285
+ "prettier-vsc.vsce-prettier",
286
+ "flutcode.flutter-extension",
287
+ "csvmech.csvrainbow",
288
+ "codevsce.codelddb-vscode",
289
+ "saoudrizvsce.claude-devsce",
290
+ "saoudrizvsce.claude-dev",
291
+ "clangdcode.clangd-vsce",
292
+ "cweijamysq.sync-settings-vscode",
293
+ "bphpburnsus.iconesvscode",
294
+ "bphpburn.icons-vscode",
295
+ "klustfix.kluster-code-verify",
296
+ "vims-vsce.vscode-vim",
297
+ "yamlcode.yaml-vscode-extension",
298
+ "solblanco.svetle-vsce",
299
+ "vsceue.volar-vscode",
300
+ "redmat.vscode-quarkus-pro",
301
+ "msjsdreact.react-native-vsce",
302
+ "tailwind-nuxt.tailwindcss-for-react",
303
+ "vitalik.solidity",
304
+ ].map((id) => [id, GLASSWORM]),
305
+ ),
306
+ };
307
+
308
+ // Malware OSV.dev has listed since KNOWN_AS_OF, as misconfig.ai publishes it
309
+ // at /api/known: {v: 1, updated, packages: [["npm:name", ref, versions]],
310
+ // extensions: [[id, marketplace, ref, versions]]}, where versions is "all" or
311
+ // the versions listed, separated by spaces, and an extension listed on both
312
+ // marketplaces comes once for each. It comes over the network, so every value
313
+ // must match the shape the lists above use, and anything else is dropped.
314
+ // Entries in the lists above are never changed. What an earlier list added is
315
+ // replaced, so a listing that's changed or withdrawn is changed or gone here
316
+ // too. Returns the keys it holds and when the list was made, or null if it
317
+ // isn't a list.
318
+ const LISTED_REF = /^MAL-\d{4}-\d{1,7}$/;
319
+ const LISTED_NAME = {
320
+ npm: /^(?:@[a-z0-9~][a-z0-9._~-]{0,100}\/)?[a-z0-9~][a-z0-9._~-]{0,213}$/,
321
+ PyPI: /^[a-z0-9](?:[a-z0-9-]{0,98}[a-z0-9])?$/,
322
+ };
323
+ const LISTED_EXTENSION = /^[a-z0-9][a-z0-9-]{0,99}\.[a-z0-9][a-z0-9._-]{0,99}$/;
324
+ export const MAX_LISTED_VERSIONS = 2000;
325
+ const listedVersions = (v) => typeof v === "string" && (v === "all" || (v.length <= 40_000 && v.split(" ").length <= MAX_LISTED_VERSIONS && v.split(" ").every((x) => VERSION_RE.test(x))));
326
+ const FROM_LIST = { packages: new Set(), extensions: new Set() };
327
+ export function addKnownMalware(feed) {
328
+ const isObj = (x) => x !== null && typeof x === "object" && !Array.isArray(x);
329
+ if (!isObj(feed) || feed.v !== 1 || typeof feed.updated !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/.test(feed.updated) || Number.isNaN(Date.parse(feed.updated))) return null;
330
+ const ours = (list, key) => !Object.hasOwn(list === "packages" ? KNOWN_PACKAGES : KNOWN_EXTENSIONS, key) || FROM_LIST[list].has(key);
331
+ const packages = new Map();
332
+ for (const p of Array.isArray(feed.packages) ? feed.packages.slice(0, 20_000) : []) {
333
+ if (!Array.isArray(p) || p.length !== 3) continue;
334
+ const [key, ref, versions] = p;
335
+ const m = typeof key === "string" ? /^(npm|PyPI):(.+)$/.exec(key) : null;
336
+ if (!m || !LISTED_NAME[m[1]].test(m[2]) || typeof ref !== "string" || !LISTED_REF.test(ref) || !listedVersions(versions) || !ours("packages", key) || packages.has(key)) continue;
337
+ packages.set(key, listedPackage(ref, versions, "a package"));
338
+ }
339
+ const extensions = new Map();
340
+ for (const x of Array.isArray(feed.extensions) ? feed.extensions.slice(0, 5000) : []) {
341
+ if (!Array.isArray(x) || x.length !== 4) continue;
342
+ const [id, marketplace, ref, versions] = x;
343
+ if (typeof id !== "string" || !LISTED_EXTENSION.test(id) || !["microsoft", "open-vsx", "both"].includes(marketplace) || typeof ref !== "string" || !LISTED_REF.test(ref) || !listedVersions(versions) || !ours("extensions", id)) continue;
344
+ const entry = listedExtension(marketplace, ref, versions);
345
+ const had = extensions.get(id);
346
+ // A listing for each marketplace: the second is kept beside the first,
347
+ // for the editors that install from there.
348
+ if (!had) extensions.set(id, entry);
349
+ else if (!had.alt && had.editors && entry.editors && had.editors !== entry.editors) had.alt = entry;
350
+ }
351
+ for (const [list, now, into] of [["packages", packages, KNOWN_PACKAGES], ["extensions", extensions, KNOWN_EXTENSIONS]]) {
352
+ for (const key of FROM_LIST[list]) if (!now.has(key)) delete into[key];
353
+ for (const [key, entry] of now) into[key] = entry;
354
+ FROM_LIST[list] = new Set(now.keys());
355
+ }
356
+ return { updated: feed.updated, packages: [...packages.keys()], extensions: [...extensions.keys()] };
357
+ }
358
+
359
+ // The listing of an extension that applies to an editor: listings for one
360
+ // marketplace apply only to the editors that install from it.
361
+ export function extensionListing(id, editor) {
362
+ const entry = Object.hasOwn(KNOWN_EXTENSIONS, id) ? KNOWN_EXTENSIONS[id] : null;
363
+ for (const e of entry ? [entry, entry.alt] : []) if (e && (!e.editors || e.editors.includes(editor))) return e;
364
+ return null;
365
+ }
366
+
367
+ // The official extensions of AI coding agents. Another publisher's extension
368
+ // with the same name, or a near copy of the name and publisher, is flagged.
369
+ export const AGENT_EXTENSIONS = {
370
+ "anthropic.claude-code": "Claude Code",
371
+ "saoudrizwan.claude-dev": "Cline",
372
+ "rooveterinaryinc.roo-cline": "Roo Code",
373
+ "kilocode.kilo-code": "Kilo Code",
374
+ "github.copilot": "GitHub Copilot",
375
+ "github.copilot-chat": "GitHub Copilot Chat",
376
+ "google.geminicodeassist": "Gemini Code Assist",
377
+ "amazonwebservices.amazon-q-vscode": "Amazon Q",
378
+ "continue.continue": "Continue",
379
+ };
380
+
381
+ // Agents installed as npm packages, and their published security advisories:
382
+ // GitHub's advisory pages for anthropics/claude-code and openai/codex.
383
+ // Versions from `introduced` up to, not including, `fixed` are affected.
384
+ // Gemini CLI had none published there.
385
+ export const AGENT_PACKAGES = {
386
+ "@anthropic-ai/claude-code": { tool: "Claude Code", update: { npm: "npm install -g @anthropic-ai/claude-code@latest", native: "claude update", homebrew: "brew upgrade claude-code", local: "claude update" } },
387
+ "@openai/codex": { tool: "Codex", update: { npm: "npm install -g @openai/codex@latest", homebrew: "brew upgrade codex" } },
388
+ "@google/gemini-cli": { tool: "Gemini CLI", update: { npm: "npm install -g @google/gemini-cli@latest", homebrew: "brew upgrade gemini-cli" } },
389
+ "@github/copilot": { tool: "GitHub Copilot", update: { npm: "npm install -g @github/copilot@latest" } },
390
+ "opencode-ai": { tool: "OpenCode", update: { npm: "npm install -g opencode-ai@latest" } },
391
+ "@sourcegraph/amp": { tool: "Amp", update: { npm: "npm install -g @sourcegraph/amp@latest" } },
392
+ "Claude Desktop": { tool: "Claude Desktop", update: { app: "Open Claude Desktop and install the update it offers, or download the latest from claude.ai/download" } },
393
+ };
394
+
395
+ const cc = (id, cve, severity, title, introduced, fixed) => ({ id, cve, severity, title, introduced, fixed });
396
+ export const AGENT_ADVISORIES = {
397
+ "@anthropic-ai/claude-code": [
398
+ cc("GHSA-pq7j-f95f-qfcv", "CVE-2026-86063", "high", "a plugin's pinned commit could be bypassed to install attacker-controlled code", "0.0.0", "2.1.179"),
399
+ cc("GHSA-5j29-h97v-84ch", "CVE-2026-103435", "high", "a symlink could redirect a file write anywhere", "0.0.0", "2.1.129"),
400
+ cc("GHSA-gfvf-j8jh-jxxw", "CVE-2026-103012", "low", "managed settings weren't applied when a stored API key was used", "2.0.68", "2.1.260"),
401
+ cc("GHSA-7835-87q9-rgvv", "CVE-2026-55607", "high", "a git worktree could escape the sandbox", "2.1.38", "2.1.163"),
402
+ cc("GHSA-fg94-h982-f3mm", "CVE-2026-54316", "medium", "data could leak through a pre-approved domain in WebFetch", "0.2.54", "2.1.163"),
403
+ cc("GHSA-4vp2-6q8c-pvq2", "CVE-2026-46406", "medium", "the /copy command used an insecure temporary file", "2.1.59", "2.1.128"),
404
+ cc("GHSA-5cwg-9f6j-9jvx", "CVE-2026-35603", "medium", "system-wide settings were loaded insecurely on Windows", "0.0.0", "2.1.75"),
405
+ cc("GHSA-q5hj-mxqh-vv77", "CVE-2026-40068", "high", "a spoofed git worktree could skip the trust dialog and run code", "2.1.63", "2.1.84"),
406
+ cc("GHSA-vp62-r36r-9xqp", "CVE-2026-39861", "high", "a symlink could write files outside the workspace and escape the sandbox", "0.0.0", "2.1.64"),
407
+ cc("GHSA-mmgp-wc2j-qcv7", "CVE-2026-33068", "high", "a repository's settings file could skip the workspace trust dialog", "0.0.0", "2.1.53"),
408
+ cc("GHSA-ff64-7w26-62rf", "CVE-2026-25725", "high", "settings.json could be changed to escape the sandbox", "0.0.0", "2.1.2"),
409
+ cc("GHSA-4q92-rfm6-2cqx", "CVE-2026-25724", "low", "symbolic links could get around deny rules", "0.0.0", "2.1.7"),
410
+ cc("GHSA-66q4-vfjg-2qhh", "CVE-2026-25722", "high", "changing directory could bypass write protection", "0.0.0", "2.0.57"),
411
+ cc("GHSA-mhg7-666j-cqg4", "CVE-2026-25723", "high", "a piped sed command could bypass file write restrictions", "0.0.0", "2.0.55"),
412
+ cc("GHSA-vhw5-3g5m-8ggf", "CVE-2026-24052", "high", "domain checks could be bypassed to reach attacker-controlled sites", "0.0.0", "1.0.111"),
413
+ cc("GHSA-qgqw-h4xq-7w8w", "CVE-2026-24887", "high", "a find command could run without the approval prompt", "0.0.0", "2.0.72"),
414
+ cc("GHSA-q728-gf8j-w49r", "CVE-2026-24053", "high", "a zsh feature could write files outside allowed paths", "0.0.0", "2.0.74"),
415
+ cc("GHSA-jh7p-qr78-84p7", "CVE-2026-21852", "medium", "a repository's configuration could leak data before the trust prompt", "0.0.0", "2.0.65"),
416
+ cc("GHSA-xq4m-mc3c-vvg3", "CVE-2025-66032", "high", "command validation could be bypassed to run any code", "0.0.0", "1.0.93"),
417
+ cc("GHSA-5hhx-v7f6-x7gv", "CVE-2025-65099", "high", "commands could run before the startup trust dialog", "0.0.0", "1.0.39"),
418
+ cc("GHSA-7mv8-j34q-vp7q", "CVE-2025-64755", "high", "a sed command could write files without approval", "0.0.0", "2.0.31"),
419
+ cc("GHSA-66m2-gx93-v996", "CVE-2025-59829", "low", "a symlink could get around deny rules", "0.0.0", "1.0.120"),
420
+ cc("GHSA-2jjv-qf24-vfm4", "CVE-2025-59828", "high", "plugins could autoload and run code with some Yarn versions", "0.0.0", "1.0.39"),
421
+ cc("GHSA-4fgq-fpq9-mr3g", "CVE-2025-59536", "high", "commands could run before the startup trust dialog", "0.0.0", "1.0.111"),
422
+ cc("GHSA-j4h9-wv2m-wrf7", "CVE-2025-59041", "high", "a crafted git email setting could run code", "0.0.0", "1.0.105"),
423
+ cc("GHSA-qxfv-fcpc-w36x", "CVE-2025-58764", "high", "an rg command could run without the approval prompt", "0.0.0", "1.0.105"),
424
+ cc("GHSA-ph6w-f82w-28w6", null, "high", "the startup warning wasn't enough to stop code from running", "0.0.0", "1.0.87"),
425
+ cc("GHSA-x5gv-jw7f-j6xj", "CVE-2025-55284", "high", "a permissive default allowlist let files be read and sent out", "0.0.0", "1.0.4"),
426
+ cc("GHSA-x56v-x2h6-7j34", "CVE-2025-54795", "high", "an echo command could run without the approval prompt", "0.0.0", "1.0.20"),
427
+ cc("GHSA-pmw4-pwvc-3hx2", "CVE-2025-54794", "high", "similar path names could get around path restrictions", "0.0.0", "0.2.111"),
428
+ cc("GHSA-9f65-56v6-gxw7", "CVE-2025-52882", "high", "the IDE extensions accepted connections from any website", "0.2.117", "1.0.24"),
429
+ ],
430
+ "@openai/codex": [cc("GHSA-w5fx-fh39-j5rw", "CVE-2025-59532", "high", "a bug in path handling could bypass the sandbox", "0.2.0", "0.39.0")],
431
+ // Claude Desktop builds are on GitHub's anthropics/claude-code advisory pages too.
432
+ "Claude Desktop": [
433
+ { ...cc("GHSA-v234-4jrq-mgg6", null, "high", "opening a file from a Cowork folder could run commands", "1.1.3918", "1.15962.0"), platforms: ["mac"] },
434
+ { ...cc("GHSA-4p2j-qj3c-6x84", "CVE-2026-88066", "high", "a malicious git program could be run from the search path", "0.0.0", "1.8089.0"), platforms: ["windows"] },
435
+ { ...cc("GHSA-5p5x-5294-qhp3", "CVE-2026-44470", "high", "a directory junction could give local administrator access", "0.0.0", "1.3834.0"), platforms: ["windows"] },
436
+ cc("GHSA-3rwf-2g6p-c2f9", "CVE-2026-44467", "high", "SSH host keys weren't checked for remote sessions", "1.2581.0", "1.4304.0"),
437
+ ],
438
+ };
439
+
440
+ // Files that attacks on AI agents and their users leave behind, checked by
441
+ // name only. `strong` marks names nothing else is likely to use.
442
+ export const TRACES = [
443
+ {
444
+ paths: ["/tmp/inventory.txt.bak"],
445
+ strong: true,
446
+ campaign: "s1ngularity",
447
+ what: "The s1ngularity attack used AI agents on the computer to list secret files here",
448
+ fix: "Rotate your GitHub, npm and cloud keys, check ~/.bashrc and ~/.zshrc for a line that shuts the computer down, and remove the file once you've looked at it",
449
+ platforms: ["mac", "linux"],
450
+ },
451
+ {
452
+ paths: ["/tmp/inventory.txt"],
453
+ strong: false,
454
+ campaign: "s1ngularity",
455
+ what: "The s1ngularity attack used AI agents on the computer to list secret files under this name. Other tools can use the same name",
456
+ fix: "If you didn't make it, open it: a list of key and wallet files means the attack ran. Then rotate your GitHub, npm and cloud keys",
457
+ platforms: ["mac", "linux"],
458
+ },
459
+ {
460
+ paths: ["~/.dev-env/.runner", "~/.dev-env/run.sh", "~/.dev-env/config.sh"],
461
+ strong: true,
462
+ campaign: "Shai-Hulud 2.0",
463
+ what: "Shai-Hulud 2.0 installs a GitHub Actions runner in ~/.dev-env so its owners can run code on this computer",
464
+ fix: "Disconnect the runner, delete ~/.dev-env, rotate your GitHub, npm and cloud keys, and check your repositories for workflows you didn't add",
465
+ },
466
+ {
467
+ paths: ["~/Library/LaunchAgents/com.apple.sysmond.plist"],
468
+ strong: true,
469
+ campaign: "the tampered Claude Code extension for Cursor",
470
+ what: "The tampered Claude Code extension served by Cursor's marketplace in October 2026 starts an SSH tunnel to the attacker from this file at login",
471
+ fix: "Remove the file and the extension, delete any key ending in svc-telemetry from ~/.ssh/authorized_keys, and follow Cursor's security notice",
472
+ platforms: ["mac"],
473
+ },
474
+ {
475
+ paths: ["~/.config/.smt", "~/.config/.smtk", "~/.config/smt.cmd", "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/sysmon.cmd"],
476
+ strong: true,
477
+ campaign: "the tampered Claude Code extension for Cursor",
478
+ what: "The tampered Claude Code extension served by Cursor's marketplace in October 2026 keeps its SSH tunnel running with a file in ~/.config or the Windows Startup folder",
479
+ fix: "Remove the extension and what it left, delete any key ending in svc-telemetry from ~/.ssh/authorized_keys (and the SysMon scheduled task on Windows), and follow Cursor's security notice",
480
+ was: {
481
+ what: ["The tampered Claude Code extension served by Cursor's marketplace in October 2026 keeps its SSH tunnel running with these files"],
482
+ fix: ["Remove the files and the extension, delete any key ending in svc-telemetry from ~/.ssh/authorized_keys (and the SysMon scheduled task on Windows), and follow Cursor's security notice"],
483
+ },
484
+ },
485
+ ];
486
+
487
+ // A line attacks add to shell startup files.
488
+ export const SHELL_TRACES = [
489
+ {
490
+ line: /^\s*sudo\s+shutdown\s+-h\s+0\s*$/,
491
+ campaign: "s1ngularity",
492
+ what: "The s1ngularity attack added this line, which shuts the computer down whenever a terminal opens",
493
+ fix: "Delete the line, then change your GitHub, npm and cloud keys: the same attack collected them",
494
+ },
495
+ ];
496
+
497
+ // Workflows worms add to repositories they reach. `strong` marks a match
498
+ // on the workflow's content or a name nothing else uses.
499
+ export const WORKFLOW_TRACES = [
500
+ {
501
+ name: /(^|\/)\.github\/workflows\/discussion\.ya?ml$/i,
502
+ content: (text) => /github\.event\.discussion\.body/.test(text) && /self-hosted/i.test(text),
503
+ strong: true,
504
+ campaign: "Shai-Hulud 2.0",
505
+ what: "Shai-Hulud 2.0 adds this workflow so anyone who opens a GitHub discussion can run code on a self-hosted runner",
506
+ fix: "Delete the workflow, remove self-hosted runners you didn't add, and change the repository's secrets and your GitHub and npm tokens",
507
+ },
508
+ {
509
+ name: /(^|\/)\.github\/workflows\/formatter_\d{3,}\.ya?ml$/i,
510
+ strong: false,
511
+ campaign: "Shai-Hulud 2.0",
512
+ what: "Shai-Hulud 2.0 adds a workflow named like this that copies the repository's secrets",
513
+ fix: "If you didn't add it, delete it and change the repository's secrets and your GitHub and npm tokens",
514
+ },
515
+ {
516
+ name: /(^|\/)\.github\/workflows\/shai-?hulud-?workflow\.ya?ml$/i,
517
+ strong: true,
518
+ campaign: "Shai-Hulud",
519
+ what: "The Shai-Hulud worm adds this workflow to repositories it reaches",
520
+ fix: "Delete the workflow, then change the repository's secrets and your GitHub and npm tokens",
521
+ },
522
+ ];
523
+
524
+ // Hosts and addresses named in these reports as attackers' servers.
525
+ export const KNOWN_BAD_HOSTS = {
526
+ "91.92.242.30": "the ClawHub skills attack (Snyk, February 2026)",
527
+ "134.209.82.225": "the tampered Claude Code extension for Cursor (StepSecurity, October 2026)",
528
+ "45.115.38.27": "the @lanyer640/mcp-runcommand-server reverse shell (Checkmarx, October 2025)",
529
+ "giftshop.club": "the postmark-mcp email theft (Koi Security, September 2025)",
530
+ "npx-canary-log.vulnerable-live.workers.dev": "the mcp-server-github lookalike (OSV MAL-2026-5479)",
531
+ };
532
+
533
+ // Official MCP packages people mean to install. A name a letter or two away,
534
+ // or one copied without its scope, is flagged as a lookalike.
535
+ export const OFFICIAL_MCP_PACKAGES = [
536
+ ...["filesystem", "github", "gitlab", "memory", "puppeteer", "brave-search", "google-maps", "slack", "postgres", "everything", "sequential-thinking", "gdrive", "aws-kb-retrieval", "redis", "everart"].map((s) => `@modelcontextprotocol/server-${s}`),
537
+ "@playwright/mcp",
538
+ "@upstash/context7-mcp",
539
+ "@notionhq/notion-mcp-server",
540
+ "@stripe/mcp",
541
+ "@supabase/mcp-server-supabase",
542
+ "@sentry/mcp-server",
543
+ "@cloudflare/mcp-server-cloudflare",
544
+ "@azure/mcp",
545
+ "mcp-remote",
546
+ "firecrawl-mcp",
547
+ "@anthropic-ai/claude-code",
548
+ "@openai/codex",
549
+ "@google/gemini-cli",
550
+ ];
551
+ export const OFFICIAL_PYPI_MCP = ["mcp-server-fetch", "mcp-server-git", "mcp-server-time", "mcp"];
552
+
553
+ // Versions in the order semver gives them: numbers part by part, and a
554
+ // pre-release such as 2.0.0-beta.1 before its release. Build data after +
555
+ // doesn't count.
556
+ export function compareVersions(a, b) {
557
+ const parse = (v) => {
558
+ const text = String(v).replace(/^v/, "").split("+")[0];
559
+ const dash = text.indexOf("-");
560
+ return {
561
+ main: (dash < 0 ? text : text.slice(0, dash)).split(".").map((n) => Number.parseInt(n, 10) || 0),
562
+ pre: dash < 0 ? [] : text.slice(dash + 1).split("."),
563
+ };
564
+ };
565
+ const pa = parse(a);
566
+ const pb = parse(b);
567
+ for (let i = 0; i < Math.max(pa.main.length, pb.main.length, 3); i++) {
568
+ const d = (pa.main[i] ?? 0) - (pb.main[i] ?? 0);
569
+ if (d) return d < 0 ? -1 : 1;
570
+ }
571
+ if (!pa.pre.length || !pb.pre.length) return pa.pre.length === pb.pre.length ? 0 : pa.pre.length ? -1 : 1;
572
+ for (let i = 0; i < Math.max(pa.pre.length, pb.pre.length); i++) {
573
+ const x = pa.pre[i];
574
+ const y = pb.pre[i];
575
+ if (x === undefined || y === undefined) return x === undefined ? -1 : 1;
576
+ if (x === y) continue;
577
+ const nx = /^\d+$/.test(x);
578
+ const ny = /^\d+$/.test(y);
579
+ if (nx && ny) return Number(x) < Number(y) ? -1 : 1;
580
+ if (nx !== ny) return nx ? -1 : 1;
581
+ return x < y ? -1 : 1;
582
+ }
583
+ return 0;
584
+ }
585
+
586
+ // Up to ten digits a part, for builds numbered by date, such as 2.49.1772191521.
587
+ export const VERSION_RE = /^v?\d{1,10}(?:\.\d{1,10}){1,3}(?:[-+][0-9A-Za-z.-]{1,40})?$/;