supply-chain-guard 4.1.0 → 4.3.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 (43) hide show
  1. package/README.md +179 -228
  2. package/dist/cli.js +1 -1
  3. package/dist/correlation-engine.d.ts +21 -0
  4. package/dist/correlation-engine.d.ts.map +1 -0
  5. package/dist/correlation-engine.js +178 -0
  6. package/dist/correlation-engine.js.map +1 -0
  7. package/dist/dependency-risk-analyzer.d.ts +16 -0
  8. package/dist/dependency-risk-analyzer.d.ts.map +1 -0
  9. package/dist/dependency-risk-analyzer.js +130 -0
  10. package/dist/dependency-risk-analyzer.js.map +1 -0
  11. package/dist/index.d.ts +6 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +14 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/install-hook-scanner.d.ts +26 -0
  16. package/dist/install-hook-scanner.d.ts.map +1 -0
  17. package/dist/install-hook-scanner.js +157 -0
  18. package/dist/install-hook-scanner.js.map +1 -0
  19. package/dist/patterns.d.ts +2 -0
  20. package/dist/patterns.d.ts.map +1 -1
  21. package/dist/patterns.js +78 -1
  22. package/dist/patterns.js.map +1 -1
  23. package/dist/publishing-anomaly-detector.d.ts +27 -0
  24. package/dist/publishing-anomaly-detector.d.ts.map +1 -0
  25. package/dist/publishing-anomaly-detector.js +102 -0
  26. package/dist/publishing-anomaly-detector.js.map +1 -0
  27. package/dist/release-scanner.d.ts +33 -0
  28. package/dist/release-scanner.d.ts.map +1 -0
  29. package/dist/release-scanner.js +99 -0
  30. package/dist/release-scanner.js.map +1 -0
  31. package/dist/reporter.js +33 -3
  32. package/dist/reporter.js.map +1 -1
  33. package/dist/scanner.d.ts.map +1 -1
  34. package/dist/scanner.js +36 -3
  35. package/dist/scanner.js.map +1 -1
  36. package/dist/trust-breakdown.d.ts +12 -0
  37. package/dist/trust-breakdown.d.ts.map +1 -0
  38. package/dist/trust-breakdown.js +137 -0
  39. package/dist/trust-breakdown.js.map +1 -0
  40. package/dist/types.d.ts +50 -0
  41. package/dist/types.d.ts.map +1 -1
  42. package/dist/types.js.map +1 -1
  43. package/package.json +1 -1
package/README.md CHANGED
@@ -1,32 +1,69 @@
1
- # 🛡️ supply-chain-guard
1
+ # supply-chain-guard
2
2
 
3
- Open-source supply-chain security scanner for npm, PyPI, VS Code extensions, GitHub Actions workflows and Solana C2. Detects [GlassWorm](https://www.reversinglabs.com/blog/glassworm-backdoor-campaign-npm-vscode) and similar malware campaigns.
3
+ Open-source supply-chain security scanner for npm, PyPI, Cargo, Go, Docker, Terraform, VS Code extensions, GitHub Actions and GitHub repositories. Detects malware campaigns (GlassWorm, Vidar, Shai-Hulud), fake AI tool repos, account takeovers, and 170+ threat indicators with a correlation engine that links findings into attack-chain incidents.
4
4
 
5
5
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
6
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D20-green)](https://nodejs.org)
7
- [![npm](https://img.shields.io/badge/npm-v3.1.0-blue)](https://www.npmjs.com/package/supply-chain-guard)
7
+ [![npm](https://img.shields.io/npm/v/supply-chain-guard)](https://www.npmjs.com/package/supply-chain-guard)
8
8
 
9
9
  ## Background
10
10
 
11
11
  For a deep dive into how GlassWorm infiltrates the software supply chain and the detection techniques behind this tool, read the blog post: [How GlassWorm Gets In and How We Locked It Out](https://blog.elvatis.com/how-glassworm-gets-in-and-how-we-locked-it-out/).
12
12
 
13
- ## What It Does
14
-
15
- supply-chain-guard scans code repositories and npm packages for known indicators of compromise (IOCs) associated with supply-chain attacks. It catches threats that traditional security scanners miss because it specifically targets software supply-chain attack patterns.
16
-
17
- **Detected threats include:**
18
-
19
- - 🔴 **GlassWorm campaign markers** (the `lzcdrtfxyqiplpd` variable and associated IOCs)
20
- - 🔴 **Obfuscated code execution** (`eval(atob(...))`, `eval(Buffer.from(...))`, `new Function(atob(...))`)
21
- - 🟠 **Invisible Unicode characters** used to hide malicious code in plain sight
22
- - 🟠 **Suspicious install scripts** (`postinstall`/`preinstall` that download and execute remote code)
23
- - 🟠 **Data exfiltration patterns** (environment variables sent over the network)
24
- - 🟡 **Solana blockchain C2** (mainnet-beta, Helius RPC references used as command-and-control channels)
25
- - 🟡 **Git history manipulation** (committer dates far newer than author dates)
26
- - 🔵 **Typosquatting package names** (known malicious npm package patterns)
27
- - 🟠 **PyPI malicious install hooks** (setup.py subprocess, base64 exec, download-and-run in cmdclass)
28
- - 🟠 **GitHub Actions CI/CD attacks** (unpinned actions, secrets exfiltration, encoded payloads in run blocks)
29
- - 🟡 **Solana C2 wallet watchlist** (persistent monitoring of known command-and-control wallets with webhook alerts)
13
+ ## What It Detects
14
+
15
+ ### Malware Campaigns
16
+ - GlassWorm campaign markers and Solana blockchain C2
17
+ - Vidar/GhostSocks infostealers (April 2026 Claude Code leak campaign)
18
+ - Shai-Hulud self-replicating npm worm
19
+ - XZ Utils backdoor (CVE-2024-3094), SolarWinds SUNBURST, Codecov, ua-parser-js, coa/rc
20
+ - Fake AI tool repos (Claude Code, Copilot, Cursor, ChatGPT, OpenClaw lures)
21
+
22
+ ### Code-Level Threats
23
+ - Obfuscated execution: `eval(atob())`, `eval(Buffer.from())`, template literal eval, dynamic `import()`
24
+ - Invisible Unicode, RTL override, SVG script injection, steganography
25
+ - Shannon entropy analysis for encoded payloads
26
+ - Proxy handler traps, WebAssembly from external sources
27
+
28
+ ### Supply Chain Attacks
29
+ - Install hook deep analysis (secret harvesting, download-exec chains, binary blobs)
30
+ - Levenshtein-based typosquatting detection against top 80 npm packages
31
+ - Dependency confusion and namespace squatting
32
+ - Known-bad version blocklist (axios, ua-parser-js, coa, rc, event-stream, node-ipc, colors, faker)
33
+ - Publishing anomaly detection (maintainer changes, version gaps, script additions)
34
+
35
+ ### Infrastructure & CI/CD
36
+ - GitHub Actions: unpinned actions, secrets exfiltration, encoded payloads, curl piping
37
+ - Dockerfile: curl pipe, unpinned base images, hardcoded secrets, SUID bits
38
+ - Terraform/IaC: inline scripts, external modules, hardcoded secrets
39
+ - Package manager configs (.npmrc, .yarnrc, pip.conf): HTTP registries, exposed tokens
40
+ - Git hooks and submodule security
41
+
42
+ ### Repository Trust Signals
43
+ - GitHub repo metadata analysis (account age, star-farming, single-commit repos)
44
+ - Release artifact scanning (.exe, .7z, double extensions, LNK shortcuts, PE magic)
45
+ - README lure detection (leaked/cracked/urgency language)
46
+
47
+ ### Credential Detection
48
+ - AWS access keys (AKIA/ASIA), GitHub tokens (ghp_/gho_), npm tokens
49
+ - SSH private keys, generic API keys, PEM private keys
50
+
51
+ ### Dead-Drop Resolver / C2 Detection
52
+ - Steam Community profiles, Telegram channels, Pastebin, GitHub Gists
53
+ - DNS TXT records, DNS-over-HTTPS, dynamic WebSocket URLs
54
+ - Known C2 domains and IPs (from IOC blocklist)
55
+
56
+ ### Correlation Engine (v4.2)
57
+ Links individual findings into incident-level attack chains:
58
+ - "GlassWorm Campaign" (marker + eval + exfiltration)
59
+ - "Vidar Stealer Infection" (dead-drop + browser theft + dropper)
60
+ - "npm Account Takeover" (maintainer change + install hooks + C2)
61
+ - "Fake Repository Malware" (lure + exe release + new account)
62
+ - 15+ correlation rules with confidence scoring
63
+
64
+ ### Trust Breakdown (v4.2)
65
+ 4-dimension trust scoring for every scan:
66
+ - Publisher Trust (40%) / Code Quality (30%) / Dependency Trust (20%) / Release Process (10%)
30
67
 
31
68
  ## Installation
32
69
 
@@ -42,120 +79,55 @@ npx supply-chain-guard scan ./my-project
42
79
 
43
80
  ## Quickstart
44
81
 
45
- **Scan a local directory:**
46
-
47
82
  ```bash
83
+ # Scan a local directory
48
84
  supply-chain-guard scan ./my-project
49
- ```
50
85
 
51
- **Scan a GitHub repository:**
52
-
53
- ```bash
86
+ # Scan a GitHub repo (includes trust signal analysis)
54
87
  supply-chain-guard scan https://github.com/user/repo
55
- ```
56
88
 
57
- **Scan an npm package (without installing it):**
89
+ # Analyze a GitHub repo for trust signals + malware
90
+ supply-chain-guard repo https://github.com/user/repo
58
91
 
59
- ```bash
60
- supply-chain-guard npm suspicious-package-name
61
- ```
62
-
63
- Example output:
64
-
65
- ```
66
- Risk Score: 68/100 (CRITICAL)
67
- Findings: 2 critical, 1 high, 1 medium
68
-
69
- 🔴 [CRITICAL] GlassWorm campaign marker variable detected
70
- Rule: GLASSWORM_MARKER | File: src/index.js:42
71
-
72
- 🔴 [CRITICAL] Base64-encoded eval detected
73
- Rule: EVAL_ATOB | File: src/loader.js:15
74
- ```
75
-
76
- See the full [Example Output](#example-output) section below for a complete scan report.
77
-
78
- ## Usage
79
-
80
- ### Scan a Local Directory
81
-
82
- ```bash
83
- supply-chain-guard scan ./my-project
84
- ```
85
-
86
- ### Scan a GitHub Repository
87
-
88
- ```bash
89
- supply-chain-guard scan https://github.com/user/repo
90
- ```
91
-
92
- ### Scan an npm Package
93
-
94
- Downloads and analyzes the published tarball without installing it:
95
-
96
- ```bash
97
- supply-chain-guard npm express
92
+ # Scan an npm package (downloads without installing)
98
93
  supply-chain-guard npm suspicious-package-name
99
- ```
100
94
 
101
- ### Monitor a Solana C2 Wallet
95
+ # Scan a PyPI package
96
+ supply-chain-guard pypi suspicious-package
102
97
 
103
- Watch a Solana wallet address for memo transactions (used by GlassWorm for C2 communication):
98
+ # Scan a VS Code extension
99
+ supply-chain-guard vscode publisher.extension-name
104
100
 
105
- ```bash
106
- # Continuous monitoring
107
- supply-chain-guard monitor <wallet-address>
101
+ # Detect dependency confusion
102
+ supply-chain-guard confusion ./my-project
108
103
 
109
- # One-shot check
104
+ # Monitor a Solana C2 wallet
110
105
  supply-chain-guard monitor <wallet-address> --once
111
-
112
- # Custom polling interval
113
- supply-chain-guard monitor <wallet-address> --interval 60
114
106
  ```
115
107
 
116
- ### Output Formats
108
+ ## Output Formats
117
109
 
118
110
  ```bash
119
- # Human-readable text (default)
120
- supply-chain-guard scan ./project
121
-
122
- # JSON (for CI/CD pipelines)
123
- supply-chain-guard scan ./project --format json
124
-
125
- # Markdown (for PR comments)
126
- supply-chain-guard scan ./project --format markdown
127
-
128
- # SARIF 2.1.0 (for GitHub Code Scanning)
129
- supply-chain-guard scan ./project --format sarif
130
-
131
- # CycloneDX 1.5 SBOM (for compliance: NIS2, SSDF, SBOM mandates)
132
- supply-chain-guard scan ./project --format sbom
111
+ supply-chain-guard scan ./project # Human-readable text (default)
112
+ supply-chain-guard scan ./project --format json # JSON (for CI/CD pipelines)
113
+ supply-chain-guard scan ./project --format html # Standalone HTML report
114
+ supply-chain-guard scan ./project --format markdown # Markdown (for PR comments)
115
+ supply-chain-guard scan ./project --format sarif # SARIF 2.1.0 (GitHub Code Scanning)
116
+ supply-chain-guard scan ./project --format sbom # CycloneDX 1.5 SBOM (NIS2/SSDF compliance)
133
117
  ```
134
118
 
135
- ### CI Exit Code Control
136
-
137
- By default, the scanner exits 2 on critical findings and 1 on high findings. Use `--fail-on` to set a custom threshold:
119
+ ## CI Exit Code Control
138
120
 
139
121
  ```bash
140
- # Fail only on critical (ignore high/medium/low)
141
- supply-chain-guard scan ./project --fail-on critical
142
-
143
- # Fail on high or above (critical + high)
144
- supply-chain-guard scan ./project --fail-on high
145
-
146
- # Fail on any finding
147
- supply-chain-guard scan ./project --fail-on info
122
+ supply-chain-guard scan ./project --fail-on critical # Fail only on critical
123
+ supply-chain-guard scan ./project --fail-on high # Fail on high or above
124
+ supply-chain-guard scan ./project --fail-on info # Fail on any finding
148
125
  ```
149
126
 
150
- This is useful for tiered CI pipelines: block deploys on critical, warn on medium.
151
-
152
- ### Filtering
127
+ ## Filtering
153
128
 
154
129
  ```bash
155
- # Only show critical and high findings
156
130
  supply-chain-guard scan ./project --min-severity high
157
-
158
- # Exclude specific rules
159
131
  supply-chain-guard scan ./project --exclude SOLANA_MAINNET,HEX_ARRAY
160
132
  ```
161
133
 
@@ -163,55 +135,58 @@ supply-chain-guard scan ./project --exclude SOLANA_MAINNET,HEX_ARRAY
163
135
 
164
136
  ```
165
137
  supply-chain-guard scan report
166
- ──────────────────────────────────────────────────────
138
+ ──────────────────────────────────────────────────
167
139
  Target: ./suspicious-package
168
140
  Type: directory
169
- Time: 2026-03-19T02:30:00.000Z
170
141
  Duration: 142ms
171
142
 
172
- Risk Score: 68/100 (CRITICAL)
173
-
174
- Summary
175
- ──────────────────────────────────────────────────────
176
- Files: 23/47 scanned
177
- Findings: 2 critical, 1 high, 1 medium
178
-
179
- Findings
180
- ──────────────────────────────────────────────────────
181
-
182
- 🔴 [CRITICAL] GlassWorm campaign marker variable detected
183
- Rule: GLASSWORM_MARKER
184
- File: src/index.js:42
185
- Match: lzcdrtfxyqiplpd
186
- Fix: Quarantine this code immediately.
187
-
188
- 🔴 [CRITICAL] Base64-encoded eval detected (common malware obfuscation)
189
- Rule: EVAL_ATOB
190
- File: src/loader.js:15
191
- Match: eval(atob("aHR0cHM6Ly..."))
192
- Fix: Do not execute this code. Decode the base64 to inspect the payload.
193
-
194
- 🟠 [HIGH] Suspicious invisible Unicode characters detected
195
- Rule: INVISIBLE_UNICODE
196
- File: src/utils.js:3
197
- Fix: Inspect this file in a hex editor.
198
-
199
- 🟡 [MEDIUM] Solana mainnet RPC reference detected
200
- Rule: SOLANA_MAINNET
201
- File: src/c2.js:8
202
- Fix: If this project has no blockchain functionality, investigate.
203
-
204
- Recommendations
205
- ──────────────────────────────────────────────────────
206
- • CRITICAL: GlassWorm malware marker detected. Quarantine immediately.
207
- • CRITICAL: Encoded code execution detected. Do not run this code.
208
- • Review files with invisible Unicode characters.
209
- • Solana blockchain references may indicate C2 communication.
143
+ Risk Score: 83/100 (CRITICAL)
144
+
145
+ Trust Breakdown
146
+ ──────────────────────────────────────────────────
147
+ Publisher: ██░░░░░░░░ 20/100
148
+ Code: ███░░░░░░░ 30/100
149
+ Deps: ██████████ 100/100
150
+ Release: ████████░░ 80/100
151
+ Overall: ████░░░░░░ 48/100
152
+
153
+ Correlated Incidents
154
+ ──────────────────────────────────────────────────
155
+
156
+ [CRITICAL] Vidar Stealer Infection (95% confidence)
157
+ Multiple infostealer indicators: dead-drop resolvers for C2,
158
+ browser credential theft, and crypto wallet targeting.
159
+ Indicators: DEAD_DROP_STEAM, VIDAR_BROWSER_THEFT, DROPPER_TEMP_EXEC
160
+
161
+ Findings (6)
162
+ ──────────────────────────────────────────────────
163
+
164
+ [CRITICAL] Steam Community profile URL in code (dead-drop resolver)
165
+ Rule: DEAD_DROP_STEAM | File: src/config.js:12
166
+
167
+ [CRITICAL] Browser credential file access (infostealer)
168
+ Rule: VIDAR_BROWSER_THEFT | File: src/steal.js:45
169
+
170
+ [CRITICAL] Dropper: write + execute in temp directory
171
+ Rule: DROPPER_TEMP_EXEC | File: src/loader.js:23
210
172
  ```
211
173
 
212
- ## GitHub Action
174
+ ## Supported Ecosystems
175
+
176
+ | Ecosystem | Command | What It Scans |
177
+ |-----------|---------|---------------|
178
+ | npm | `scan`, `npm` | package.json, install scripts, lockfile, tarball |
179
+ | PyPI | `pypi` | setup.py, setup.cfg, pyproject.toml, install hooks |
180
+ | Cargo/Rust | `scan` | Cargo.toml, build.rs, proc macros |
181
+ | Go | `scan` | go.mod, init() functions, CGo, plugin loading |
182
+ | Docker | `scan` | Dockerfile, docker-compose.yml, Containerfile |
183
+ | Terraform | `scan` | .tf, .hcl files (provisioners, modules, secrets) |
184
+ | VS Code | `vscode` | .vsix files, activation events, dangerous APIs |
185
+ | GitHub Actions | `scan` | .github/workflows/*.yml |
186
+ | GitHub Repos | `repo` | Trust signals, releases, README lures |
187
+ | Solana | `monitor` | C2 wallet memo transactions |
213
188
 
214
- Add supply-chain-guard to your CI/CD pipeline:
189
+ ## GitHub Action
215
190
 
216
191
  ```yaml
217
192
  name: Supply Chain Security
@@ -222,10 +197,10 @@ jobs:
222
197
  runs-on: ubuntu-latest
223
198
  steps:
224
199
  - uses: actions/checkout@v4
225
- - uses: homeofe/supply-chain-guard@v1
200
+ - uses: homeofe/supply-chain-guard@v4
226
201
  with:
227
- fail-on: critical # Fail CI on critical findings
228
- comment-on-pr: true # Post findings as PR comment
202
+ fail-on: critical
203
+ comment-on-pr: true
229
204
  ```
230
205
 
231
206
  ### Action Inputs
@@ -233,53 +208,15 @@ jobs:
233
208
  | Input | Description | Default |
234
209
  |-------|-------------|---------|
235
210
  | `path` | Path to scan | `.` |
236
- | `format` | Output format (text/json/markdown) | `markdown` |
211
+ | `format` | Output format (text/json/markdown/html/sarif/sbom) | `markdown` |
237
212
  | `min-severity` | Minimum severity to report | `low` |
238
213
  | `exclude-rules` | Comma-separated rule IDs to exclude | |
239
214
  | `fail-on` | Fail check at this severity or above | `critical` |
240
215
  | `comment-on-pr` | Post findings as PR comment | `true` |
241
216
 
242
- ### Action Outputs
243
-
244
- | Output | Description |
245
- |--------|-------------|
246
- | `score` | Risk score (0-100) |
247
- | `risk-level` | clean/low/medium/high/critical |
248
- | `findings-count` | Total number of findings |
249
- | `report` | Full scan report |
250
-
251
- ## Detection Rules
252
-
253
- | Rule ID | Severity | Description |
254
- |---------|----------|-------------|
255
- | `GLASSWORM_MARKER` | Critical | GlassWorm campaign marker variable |
256
- | `EVAL_ATOB` | Critical | Base64-encoded eval |
257
- | `EVAL_BUFFER` | Critical | Buffer-encoded eval |
258
- | `FUNCTION_ATOB` | Critical | Function constructor with base64 |
259
- | `EVAL_HEX` | Critical | Hex-encoded eval |
260
- | `SCRIPT_CURL_EXEC` | Critical | Install script with curl pipe to shell |
261
- | `SCRIPT_WGET_EXEC` | Critical | Install script with wget pipe to shell |
262
- | `INVISIBLE_UNICODE` | High | Invisible Unicode characters (obfuscation) |
263
- | `SUSPICIOUS_I_JS` | High | Suspicious i.js file |
264
- | `SUSPICIOUS_INIT_JSON` | High | GlassWorm persistence file |
265
- | `EXEC_ENCODED` | High | Encoded exec call |
266
- | `SCRIPT_NODE_INLINE` | High | Inline Node.js in install script |
267
- | `SCRIPT_ENCODED` | High | Encoding in install script |
268
- | `ENV_EXFILTRATION` | High | Environment variable exfiltration |
269
- | `DNS_EXFILTRATION` | High | DNS-based data exfiltration |
270
- | `MALICIOUS_PACKAGE_NAME` | High | Known malicious package name pattern |
271
- | `MALICIOUS_DEPENDENCY` | High | Dependency matches malicious pattern |
272
- | `SOLANA_MAINNET` | Medium | Solana mainnet RPC reference |
273
- | `HELIUS_RPC` | Medium | Helius RPC reference |
274
- | `HEX_ARRAY` | Medium | Large hex array (obfuscated payload) |
275
- | `CHARCODE_OBFUSCATION` | Medium | Character code string construction |
276
- | `SCRIPT_PREINSTALL_EXEC` | Medium | Exec in preinstall script |
277
- | `GIT_DATE_ANOMALY` | Medium | Git commit date manipulation |
278
- | `COMPLEX_INSTALL_SCRIPT` | Low | Complex install script |
279
-
280
217
  ## Adding Custom Patterns
281
218
 
282
- Edit `src/patterns.ts` to add new detection rules. Each pattern needs:
219
+ Edit `src/patterns.ts` to add new detection rules:
283
220
 
284
221
  ```typescript
285
222
  {
@@ -291,54 +228,68 @@ Edit `src/patterns.ts` to add new detection rules. Each pattern needs:
291
228
  }
292
229
  ```
293
230
 
294
- ## How It Works
295
-
296
- 1. **File Scanner**: Recursively scans directories, skipping `node_modules`, `.git`, and build artifacts. Checks file content against known malicious patterns using regex.
297
-
298
- 2. **npm Scanner**: Downloads package tarballs from the npm registry without installing them. Analyzes package.json scripts, dependencies, and published file contents.
299
-
300
- 3. **Solana Monitor**: Polls the Solana blockchain for transactions on known C2 wallet addresses. Decodes memo instructions that GlassWorm uses to encode payload URLs.
231
+ ## Architecture
301
232
 
302
- 4. **Scoring**: Each finding contributes to a risk score based on severity. The score determines the overall risk level (clean/low/medium/high/critical).
303
-
304
- ## Background: The GlassWorm Campaign
305
-
306
- In early 2026, researchers discovered the GlassWorm campaign: a coordinated supply-chain attack targeting npm packages and VS Code extensions. The campaign used several novel techniques:
307
-
308
- - **Solana blockchain as C2**: Payload URLs encoded as transaction memos on the Solana blockchain, making the C2 channel uncensorable
309
- - **Invisible Unicode**: Zero-width characters used to hide malicious code in legitimate-looking files
310
- - **Git history manipulation**: Fake commit dates to make packages appear established
311
- - **Typosquatting**: Hundreds of packages with names similar to popular libraries
312
-
313
- supply-chain-guard was built to detect these specific attack patterns and make the detection rules available to everyone.
233
+ ```
234
+ scan() -> collectFiles() -> per-file analysis
235
+ -> Pattern matching (170+ rules across 12 categories)
236
+ -> Entropy analysis (Shannon entropy for encoded payloads)
237
+ -> IOC blocklist check (known C2 domains, IPs, hashes)
238
+ -> Install hook deep analysis (secret harvesting, download-exec)
239
+ -> Dependency risk analysis (Levenshtein typosquatting)
240
+ -> Sub-scanners (lockfile, GitHub Actions, Docker, Cargo, Go, IaC)
241
+ -> GitHub trust signal analysis (account age, stars, releases)
242
+ -> Correlation engine (links findings into incidents)
243
+ -> Trust breakdown (4-dimension scoring)
244
+ -> Report generation (text/json/html/markdown/sarif/sbom)
245
+ ```
314
246
 
315
247
  ## Contributing
316
248
 
317
249
  See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. The most impactful contribution is adding new detection patterns for emerging threats.
318
250
 
319
-
320
251
  ## Changelog
321
252
 
253
+ ### v4.3.0 (2026-04-04)
254
+ - Documentation overhaul: complete README rewrite covering all features through v4.2
255
+ - Updated all version references, examples, and detection rule tables
256
+
257
+ ### v4.2.0 (2026-04-04)
258
+ - **New: Correlation Engine** -- links findings into incident-level attack chains (15+ rules)
259
+ - **New: Trust Breakdown** -- 4-dimension scoring (publisher/code/dependency/release)
260
+ - **New: Install Hook Scanner** -- deep analysis (secret harvesting, download-exec, binary blobs)
261
+ - **New: Dependency Risk Analyzer** -- Levenshtein typosquat detection
262
+ - **New: Publishing Anomaly Detector** -- maintainer changes, version gaps
263
+ - **New: Release Scanner** -- double extensions, LNK, PE magic, password hints
264
+ - **New:** C2 patterns (DoH, Gist dead-drops, dynamic WebSocket)
265
+ - **New:** Secrets detection (AWS, GitHub, SSH, npm tokens, private keys)
266
+ - 59 new tests (464 total), ~174 detection rules
267
+
268
+ ### v4.1.0 (2026-04-04)
269
+ - **New: GitHub Trust Scanner** -- repo metadata, star-farming, release artifacts, README lures
270
+ - **New: IOC Blocklist** -- known C2 domains/IPs, malware hashes, bad npm versions, malicious accounts
271
+ - **New:** Vidar/GhostSocks/dropper patterns, dead-drop resolver detection
272
+ - **New:** Claude Code leak campaign signatures, fake AI tool lure detection
273
+ - 42 new tests (405 total), ~143 detection rules
274
+
275
+ ### v4.0.0 (2026-04-04)
276
+ - **New:** Dockerfile, package config, git security, Cargo/Rust, Go module, entropy scanners
277
+ - **New:** Build-tool, monorepo, IaC/Terraform patterns
278
+ - **New:** HTML report format with severity filtering
279
+ - **New:** Shai-Hulud worm, advanced obfuscation, campaign signatures
280
+ - 94 new tests (363 total), 110+ detection rules
281
+
322
282
  ### v3.1.0 (2026-03-26)
323
- - **New:** SBOM export in CycloneDX 1.5 JSON format (`--format sbom`) for compliance (NIS2, SSDF)
324
- - **New:** `--fail-on <severity>` flag for tiered CI pipelines (fail only at specified severity threshold)
325
- - **Tests:** Full unit test coverage for solana-monitor (23 tests), reporter (39 tests), CLI integration (22 tests)
326
- - **Total:** 269 tests, all passing
283
+ - SBOM export (CycloneDX 1.5), `--fail-on` flag, full test coverage (269 tests)
327
284
 
328
285
  ### v3.0.0 (2026-03-26)
329
- - **New:** PyPI scanner detects malicious `setup.py` install hooks (subprocess, base64 exec, cmdclass downloads)
330
- - **New:** GitHub Actions workflow scanner detects CI/CD pipeline attacks (unpinned actions, secrets exfiltration, encoded payloads)
331
- - **New:** SARIF 2.1.0 output format for GitHub Code Scanning integration (`--format sarif`)
332
- - **New:** Solana C2 wallet watchlist with persistent monitoring and webhook alerts (`watchlist` commands)
333
- - **New:** Blog post reference and improved quickstart guide
334
- - **Docs:** Example GitHub Actions workflow for SARIF upload at `docs/github-actions-sarif.yml`
286
+ - PyPI scanner, GitHub Actions scanner, SARIF output, Solana watchlist
335
287
 
336
288
  ### v2.0.0
337
- - Multi-platform scanner (npm, PyPI, VS Code)
338
- - Dependency confusion detection
339
- - Lockfile integrity checks
340
- - Solana C2 monitoring
289
+ - Multi-platform scanner (npm, PyPI, VS Code), dependency confusion, lockfile checks
341
290
 
291
+ ### v1.0.0
292
+ - Initial release: GlassWorm detection, npm scanning, Solana C2 monitoring
342
293
 
343
294
  ## License
344
295
 
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ const program = new commander_1.Command();
20
20
  program
21
21
  .name("supply-chain-guard")
22
22
  .description("Open-source supply-chain security scanner. Detects GlassWorm and similar malware campaigns in npm packages, PyPI packages, code repos, VS Code extensions, and project dependencies.")
23
- .version("4.1.0");
23
+ .version("4.3.0");
24
24
  // ── scan command ────────────────────────────────────────────────────
25
25
  program
26
26
  .command("scan")
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Correlation engine (v4.2) — CORE FEATURE.
3
+ *
4
+ * Aggregates individual findings into incident-level clusters.
5
+ * Links related findings, boosts confidence, generates attack narratives,
6
+ * and reduces noise by grouping related indicators.
7
+ */
8
+ import type { Finding, IncidentCluster } from "./types.js";
9
+ export interface CorrelationResult {
10
+ /** Grouped incident clusters */
11
+ incidents: IncidentCluster[];
12
+ /** Risk score boost from correlations (0-30) */
13
+ riskBoost: number;
14
+ /** Human-readable insights */
15
+ insights: string[];
16
+ }
17
+ /**
18
+ * Correlate findings into incident clusters.
19
+ */
20
+ export declare function correlateFindings(findings: Finding[]): CorrelationResult;
21
+ //# sourceMappingURL=correlation-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation-engine.d.ts","sourceRoot":"","sources":["../src/correlation-engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAY,eAAe,EAAE,MAAM,YAAY,CAAC;AA2JrE,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAoDxE"}