@lateos/npm-scan 0.18.2 → 1.0.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 (113) hide show
  1. package/CHANGELOG.md +265 -233
  2. package/LICENSING.md +19 -19
  3. package/README.de.md +708 -708
  4. package/README.fr.md +707 -707
  5. package/README.ja.md +704 -704
  6. package/README.md +861 -826
  7. package/README.zh.md +708 -708
  8. package/VALIDATION.md +92 -0
  9. package/backend/cra.js +68 -68
  10. package/backend/db/pg-schema.sql +155 -0
  11. package/backend/db/schema.sql +32 -32
  12. package/backend/db.js +88 -88
  13. package/backend/detectors/atk-001-lifecycle.js +17 -17
  14. package/backend/detectors/atk-002-obfusc.js +261 -261
  15. package/backend/detectors/atk-003-creds.js +13 -13
  16. package/backend/detectors/atk-004-persist.js +13 -13
  17. package/backend/detectors/atk-005-exfil.js +13 -13
  18. package/backend/detectors/atk-006-depconf.js +14 -14
  19. package/backend/detectors/atk-007-typosquat.js +34 -34
  20. package/backend/detectors/atk-008-tarball-tamper.js +91 -91
  21. package/backend/detectors/atk-009-dormant-trigger.js +62 -62
  22. package/backend/detectors/atk-010-sandbox-evasion.js +50 -50
  23. package/backend/detectors/atk-011-transitive-prop.js +76 -76
  24. package/backend/detectors/config/thresholds.js +66 -0
  25. package/backend/detectors/config/whitelist.json +74 -0
  26. package/backend/detectors/cve-2026-48710-badhost/codePattern.js +99 -99
  27. package/backend/detectors/cve-2026-48710-badhost/findings.js +105 -105
  28. package/backend/detectors/cve-2026-48710-badhost/index.js +15 -15
  29. package/backend/detectors/cve-2026-48710-badhost/manifest.js +305 -305
  30. package/backend/detectors/cve-2026-48710-badhost/transitive.js +189 -189
  31. package/backend/detectors/hf-impersonation/index.js +396 -396
  32. package/backend/detectors/hf-impersonation/jaro-winkler.js +44 -44
  33. package/backend/detectors/hf-impersonation/known-orgs.js +5 -5
  34. package/backend/detectors/hf-impersonation/simhash.js +46 -46
  35. package/backend/detectors/index.js +87 -81
  36. package/backend/detectors/lib/ast-patterns.js +21 -0
  37. package/backend/detectors/lib/entropy-analyzer.js +24 -0
  38. package/backend/detectors/megalodon/d1-workflow-scan.js +147 -147
  39. package/backend/detectors/megalodon/d2-credential-harvest.js +61 -61
  40. package/backend/detectors/megalodon/d3-publish-velocity.js +67 -67
  41. package/backend/detectors/megalodon/d4-publisher-drift.js +124 -124
  42. package/backend/detectors/megalodon/d5-bot-commit-identity.js +3 -3
  43. package/backend/detectors/megalodon/d6-date-anachronism.js +3 -3
  44. package/backend/detectors/megalodon/index.js +80 -80
  45. package/backend/detectors/megalodon/types.js +9 -9
  46. package/backend/detectors/mini-shai-hulud/d1-burst-publish.js +42 -42
  47. package/backend/detectors/mini-shai-hulud/d2-sibling-compromise.js +116 -116
  48. package/backend/detectors/mini-shai-hulud/d3-slsa-mismatch.js +72 -72
  49. package/backend/detectors/mini-shai-hulud/d4-maintainer-anomaly.js +45 -45
  50. package/backend/detectors/mini-shai-hulud/d5-ioc-check.js +95 -95
  51. package/backend/detectors/mini-shai-hulud/d6-token-exfil.js +38 -38
  52. package/backend/detectors/mini-shai-hulud/index.js +118 -118
  53. package/backend/detectors/mini-shai-hulud/iocs.json +79 -79
  54. package/backend/detectors/tier1-binary-embed.js +34 -5
  55. package/backend/detectors/tier1-obfuscation-heuristics.js +156 -0
  56. package/backend/detectors/tier1-slsa-attestation.js +12 -0
  57. package/backend/detectors/tier1-version-anomaly.js +187 -0
  58. package/backend/detectors.test.js +88 -0
  59. package/backend/fetch.js +175 -175
  60. package/backend/index.js +4 -4
  61. package/backend/license.js +89 -89
  62. package/backend/lockfile.js +379 -379
  63. package/backend/pdf.js +245 -245
  64. package/backend/policy.js +193 -193
  65. package/backend/report.js +254 -254
  66. package/backend/sbom.js +66 -66
  67. package/backend/scripts/analyze-false-positives.js +146 -0
  68. package/backend/scripts/analyze-validation.js +151 -0
  69. package/backend/scripts/detect-false-positives.js +93 -0
  70. package/backend/scripts/fetch-top-packages.js +129 -0
  71. package/backend/scripts/validate-detectors.js +142 -0
  72. package/backend/siem/cef.js +32 -32
  73. package/backend/siem/ecs.js +40 -40
  74. package/backend/siem/index.js +18 -18
  75. package/backend/siem/qradar.js +56 -56
  76. package/backend/siem/sentinel.js +27 -27
  77. package/backend/tests-d5-enhanced.test.js +46 -0
  78. package/backend/tests-d6-version-anomaly.test.js +58 -0
  79. package/backend/tests-d6.test.js +116 -0
  80. package/backend/tests-d6c.test.js +106 -0
  81. package/backend/tests-d7-obfuscation.test.js +91 -0
  82. package/backend/tests.test.js +898 -0
  83. package/backend/vsix-scan/detectors/activation-event-risk.js +116 -116
  84. package/backend/vsix-scan/detectors/burst-publish.js +52 -52
  85. package/backend/vsix-scan/detectors/exfil-pattern.js +88 -88
  86. package/backend/vsix-scan/detectors/known-ioc.js +105 -105
  87. package/backend/vsix-scan/detectors/orphan-commit-fetch.js +69 -69
  88. package/backend/vsix-scan/detectors/publisher-anomaly.js +70 -70
  89. package/backend/vsix-scan/index.js +183 -183
  90. package/backend/vsix-scan/marketplace-client.js +145 -145
  91. package/backend/vsix-scan/vsix-iocs.json +31 -31
  92. package/cli/cli.js +458 -458
  93. package/package.json +74 -57
  94. package/.dockerignore +0 -20
  95. package/.husky/pre-commit +0 -1
  96. package/SECURITY.md +0 -73
  97. package/deploy/helm/npm-scan/Chart.yaml +0 -22
  98. package/deploy/helm/npm-scan/templates/_helpers.tpl +0 -9
  99. package/deploy/helm/npm-scan/templates/api.yaml +0 -94
  100. package/deploy/helm/npm-scan/templates/ingress.yaml +0 -28
  101. package/deploy/helm/npm-scan/templates/postgresql.yaml +0 -67
  102. package/deploy/helm/npm-scan/templates/secrets.yaml +0 -19
  103. package/deploy/helm/npm-scan/templates/worker.yaml +0 -32
  104. package/deploy/helm/npm-scan/values.byoc.yaml +0 -75
  105. package/deploy/helm/npm-scan/values.yaml +0 -103
  106. package/scripts/download-corpus.js +0 -30
  107. package/scripts/gen-mal-corpus.js +0 -35
  108. package/scripts/generate-campaign-fixtures.js +0 -170
  109. package/src/config/top-5000.json +0 -87
  110. package/test/fixtures/lockfiles/npm-lock.json +0 -69
  111. package/test/fixtures/lockfiles/pnpm-lock.yaml +0 -118
  112. package/test/fixtures/lockfiles/yarn.lock +0 -104
  113. package/test/fixtures/mock-data.js +0 -69
package/CHANGELOG.md CHANGED
@@ -1,234 +1,266 @@
1
- # Changelog
2
-
3
- All notable changes to [@lateos/npm-scan](https://github.com/lateos-ai/npm-scan) are documented here.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
-
7
- ## [Unreleased]
8
-
9
- ### Added
10
-
11
- ## v0.18.2June 2, 2026
12
-
13
- ### New Detectors
14
- - **D6a** `tier1-version-confusion.js` Detects dependency confusion via sentinel
15
- versions (99.99.99 family HIGH) and high-version heuristic (major≥9 MEDIUM).
16
- Covers Sonatype-2026-003429 and Microsoft scope confusion campaigns.
17
- - **D6b** `tier1-multistage-postinstall.js` Detects two-stage remote download +
18
- binary execution and detached background persistence in lifecycle scripts.
19
- Covers Gen-2 stager patterns from the OpenSearch/ES typosquatting wave.
20
- - **D6c** `tier1-cloud-imds.js` Detects GCP metadata server and Azure IMDS endpoint
21
- targeting in scripts and JS files. Covers the Miasma @redhat-cloud-services campaign.
22
-
23
- ### Detector Enhancements
24
- - **D2** `tier1-infostealer.js` — Added NAMED_SIGNATURES array with early-return
25
- CRITICAL detection for confirmed malware campaign strings. First entry: Miasma
26
- campaign identifier (June 2026).
27
-
28
- ### Bug Fixes
29
- - **D6b** `tier1-multistage-postinstall.js`
30
- - Removed /g flag from REMOTE_FETCH_RE, BINARY_EXEC_RE, DETACHED_RE —
31
- eliminated fragile lastIndex state between hook iterations
32
- - Added critical severity tier to severityLabel Signal A+B findings
33
- now consistently report severity: critical / confidence: CRITICAL
34
- - Fixed hardcoded "postinstall" in finding message — now reflects
35
- whichever hook fired and the subtype string
36
-
37
- ### Infrastructure
38
- - Added Detector Registry section to AGENTS.md with calibration notes.
39
-
40
- ### Test Suite
41
- - 656 passing, 0 failing, 19 skipping.
42
-
43
- ### Added
44
- - `scan --file <path>` flag to analyze local `.tgz` tarballs without fetching from npm registry
45
- - `scan --fail-on <level>` flag to exit with code 1 when findings >= severity (CI/CD integration)
46
- - `scan --sarif [file]` to output SARIF v2.1 format for GitHub Advanced Security, VS Code, Azure DevOps
47
- - `scan --csv [file]` and `report --csv [file]` to export tabular CSV for Excel/Sheets import
48
- - `scan --score-only` to output only risk score (0-10), auto-added to JSON output
49
- - Government/SOC 2 features: `--audit-log`, `--fips`, `--stig`, `--cache-dir` for air-gapped/federal compliance
50
- - **BYOC (Bring Your Own Cloud)**: Helm chart v1.0.0 for enterprise/government VPC deployments with SIEM, PDF, SSO
51
-
52
- ## [0.9.7]2026-05-12
53
-
54
- - Sigstore provenance attestation on every publish via new GitHub Actions workflow
55
- - Fix duplicate Docker section in README.md
56
- - Add SECURITY.md with vulnerability disclosure policy and PGP key
57
-
58
- ## [0.9.6] 2026-05-12
59
-
60
- - Add Docker badge (`ghcr.io/lateos/npm-scan`) to all 5 READMEs
61
- - Add dedicated Docker quick-start section in all languages
62
- - Replace duplicate Docker pull instructions in Integrations with cross-references
63
-
64
- ## [0.9.5]2026-05-12
65
-
66
- - Fix literal `\n` escape sequences in LICENSING.md (replaced with real newlines)
67
-
68
- ## [0.9.4] — 2026-05-11
69
-
70
- - Fix language badge links to use absolute GitHub URLs so they work from npm web UI
71
- - Fix GitHub organization links from `lateos` to `lateos-ai` across all READMEs
72
-
73
- ## [0.9.3] 2026-05-11
74
-
75
- - Add multi-language README: Chinese (`README.zh.md`), Japanese (`README.ja.md`), French (`README.fr.md`), German (`README.de.md`)
76
- - Language-switcher badges with absolute GitHub URLs in all 5 READMEs
77
-
78
- ## [0.9.2] 2026-05-11
79
-
80
- - **222 tests across 8 test files** (212 passing, 10 skipped for known FPs)
81
- - **85% line coverage** with Node.js native test runner
82
- - New test files: `test/db.test.js`, `test/detectors-edge-cases.test.js`, `test/detectors-corpus.test.js`, `test/report-snapshots.test.js`, `test/fetch.test.js`, `test/policy-edge-cases.test.js`, `test/cli.test.js`, `test/fixtures/mock-data.js`
83
- - `backend/db.js:close()` resets `initPromise = null` for test isolation
84
- - GitHub Actions CI with Node 18/20/22 matrix, corpus tests, and self-scan
85
- - GitHub Actions PR lockfile scanner with `fail-on: high`
86
-
87
- ## [0.9.1] 2026-05-11
88
-
89
- - Remove `node-fetch` import and dependency (replaced in 0.9.0)
90
-
91
- ## [0.9.0] — 2026-05-11
92
-
93
- - **Replace `node-fetch` with native `fetch`** (Node 18+) — removes external HTTP dependency
94
- - **Replace `better-sqlite3` with `sql.js`** (WASM) zero native compilation, fixes `npx` silent failure on systems without build tools
95
- - Add 404 check in `backend/fetch.js` for robust registry lookups
96
- - Reduce ATK-009 false positives on `lodash`/`axios`/`express`
97
- - Fix ATK-002/011 false positives — stricter eval+decode rules, remove self-referential checks
98
- - Fix ATK-008 `knownRepos` for `vue`
99
-
100
- ## [0.8.0] — 2026-05-11
101
-
102
- - **YAML/JSON policy-as-code engine** allowlists, severity overrides, suppressions, `fail_on` threshold
103
- - **Text report generator** (free tier)
104
- - **PDF report generator** (premium, via `pdf-lib`)
105
- - **Docker**: multi-stage builds, Compose profiles, health checks, validation script, Makefile
106
- - Comprehensive README rewrite with comparison table, ATK taxonomy, usage examples, integrations
107
- - `.npmignore` cleanup for smaller package
108
-
109
- ## [0.7.6] — 2026-05-10
110
-
111
- - **GitHub Action** (`action.yml`) — scan on push/PR with lockfile or package mode, fail-on severity threshold, SIEM/SBOM output support
112
- - **28 comprehensive tests** covering SIEM exporters (CEF, ECS, Sentinel, QRadar), EU CRA compliance, SBOM (CycloneDX + SPDX), License key gen/validation/edition/tamper/expiry, Report/NIST (HTML, SR-series table, severity badges, all 11 ATK IDs)
113
- - Fix tampered key test determinism
114
-
115
- ## [0.7.5] 2026-05-10
116
-
117
- - Add Elastic ECS, Microsoft Sentinel, and IBM QRadar SIEM exporters
118
-
119
- ## [0.7.4] — 2026-05-10
120
-
121
- - Version bump only; no functional changes
122
-
123
- ## [0.7.3] — 2026-05-10
124
-
125
- - Version bump only; no functional changes
126
-
127
- ## [0.7.2] 2026-05-10
128
-
129
- - Fix duplicate Enterprise Features section in README
130
-
131
- ## [0.7.1] — 2026-05-10
132
-
133
- - Add SAML SSO and REST API sections to README
134
-
135
- ## [0.7.0] 2026-05-10
136
-
137
- - **Enterprise SAML SSO integration**
138
-
139
- ## [0.6.0] 2026-05-10
140
-
141
- - **License key enforcement** HMAC-signed keys with community/premium/enterprise editions
142
- - Feature gating for SIEM, CRA, REST API, Helm, PostgreSQL backend, SSO, audit logs
143
- - **PostgreSQL schema** — teams, users, RBAC, audit log, webhooks, API keys, materialized `package_risk` view
144
- - **FastAPI REST API** scan/list/retrieve endpoints, webhook CRUD with HMAC-signed dispatch
145
- - **Webhook engine** event dispatch with retry, signature verification header
146
- - **Helm chart** — API + worker + PostgreSQL deployments, secrets, ingress, PVC
147
- - CLI hardened: premium features blocked without valid license key
148
-
149
- ## [0.5.0] 2026-05-10
150
-
151
- - **ATK-011 (Transitive Propagation)** detector
152
- - **SIEM CEF export** for Splunk and ArcSight integration
153
- - **EU CRA compliance report** EU Cyber Resilience Act readiness assessment
154
- - Phase 3 enterprise foundation
155
-
156
- ## [0.4.1] — 2026-05-10
157
-
158
- - Update README for Phase 3 (ATK-011, SIEM, CRA)
159
-
160
- ## [0.4.0] — 2026-05-10
161
-
162
- - **ATK-008 (Tarball Tampering)**, **ATK-009 (Dormant Trigger)**, **ATK-010 (Sandbox Evasion)** detectors
163
- - **SPDX 2.3 SBOM** support alongside CycloneDX
164
- - **NIST SP 800-161 compliance report** — supply chain risk management controls
165
- - Sandbox threat model and gVisor isolation strategy
166
-
167
- ## [0.3.3] — 2026-05-10
168
-
169
- - Fix report HTML/SBOM generation to use `atk_id`, description, package name, dynamic version
170
-
171
- ## [0.3.2] — 2026-05-10
172
-
173
- - Update README for Phase 2 (ATK-008–010, SPDX, NIST)
174
-
175
- ## [0.3.1]2026-05-10
176
-
177
- - Fix schema literal newlines
178
- - Fix CLI SBOM defaults
179
- - Fix SBOM finding IDs
180
-
181
- ## [0.3.0] — 2026-05-10
182
-
183
- - **ATK-001 (Lifecycle Script)** detector — detects `preinstall`, `postinstall`, `preuninstall` hooks with suspicious commands
184
- - **ATK-002 (Obfuscated Payload)** detector hex/base64/decode-driven eval, regex obfuscation
185
- - **ATK-003 (Credential Harvester)** detector env var exfiltration, filesystem credential scraping
186
- - **ATK-004 (Persistence Mechanism)** detector — cron jobs, startup scripts, `postinstall` service installs
187
- - **ATK-005 (Data Exfiltration)** detector — DNS tunneling, HTTP beaconing, unexpected network calls
188
- - **ATK-006 (Dependency Confusion)** detector internal package name heuristics
189
- - **ATK-007 (Typosquatting)** detector — edit-distance based package name similarity
190
-
191
- ## [0.2.5] — 2026-05-10
192
-
193
- - Fix `.npmignore` to exclude corpus tarballs from published package
194
-
195
- ## [0.2.4] 2026-05-10
196
-
197
- - Version bump only; no functional changes
198
-
199
- ## [0.2.2] — 2026-05-10
200
-
201
- - **Corpus test suite** 50 clean packages (0% FP) + 22 malicious PoC (100% detect rate)
202
- - **HTML report generator** with CLI `--html` flag
203
- - ATK-007 edit-distance typosquatting implementation
204
- - Switch from `adm-zip` to `tar` for tgz extraction
205
- - ATK detectors hardened for fewer false positives
206
- - `README.md`, `.gitignore`, corpus download scripts
207
- - **Phase 1 exit**: FP < 2%, passes unit tests + corpus
208
-
209
- ## [0.2.1] 2026-05-10
210
-
211
- - Version bump only; no functional changes
212
-
213
- ## [0.2.0] — 2026-05-10
214
-
215
- - **Commander.js CLI** with `scan`, `scan-lockfile`, `report` commands
216
- - **ATK-001–007 detector stubs** via `backend/detectors/index.js` (`runAll`)
217
- - **SQLite persistence** via `better-sqlite3` scan auto-save, report by ID/recent
218
- - **CycloneDX SBOM** — JSON and XML output with ATK vulnerability references
219
- - `.github/workflows/scan.yml`GitHub Action example for PR scanning
220
- - Dependencies: `commander`, `adm-zip`, `acorn`, `node-fetch`
221
-
222
- ## [0.1.0] — 2026-05-09
223
-
224
- - **Initial foundation**
225
- - Monorepo structure (`cli/`, `backend/`, `docker/`, `docs/`)
226
- - `LICENSING.md` — Apache-2.0 core + Commons Clause for premium features
227
- - `CONTRIBUTING.md`
228
- - `docs/attack-taxonomy.md` — ATK-001 through ATK-011 stubs
229
- - `backend/license.js` skeleton for HMAC-signed license key gating
230
- - `backend/db/schema.sql`
231
- - `docker/Dockerfile.cli` + `docker-compose.yml`
232
- - npm scripts (lint, test stubs)
233
- - `.github/workflows/ci.yml`
1
+ # Changelog
2
+
3
+ All notable changes to [@lateos/npm-scan](https://github.com/lateos-ai/npm-scan) are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ### Added
10
+
11
+ ## [1.0.0] — 2026-06-03
12
+
13
+ ### Added
14
+ - **Production Validation**: D6, D7, D5 detectors validated against 3 real May 2026 supply chain attack campaigns (100% detection rate)
15
+ - **False Positive Calibration**: Thresholds calibrated on top 1,000 npm packages; 0.0% FP rate at production thresholds
16
+ - **D6 (Version Anomaly Detector)**: Z-score-based detection of dependency confusion attacks (e.g., 99.99.99 hijack)
17
+ - **D7 (Obfuscation Heuristics Detector)**: Shannon entropy + 9-pattern AST matching for malicious obfuscation
18
+ - **D5 Enhancement (Binary Embedding)**: Cross-platform binary set detection (ELF, Mach-O, PE)
19
+ - **Config-Driven Thresholds**: `backend/detectors/config/thresholds.js` with per-detector confidence settings
20
+ - **Whitelist System**: `backend/detectors/config/whitelist.json` for known-good packages (webpack, terser, lodash, etc.)
21
+ - **Validation Scripts**: `backend/scripts/validate-detectors.js`, `analyze-validation.js`, `fetch-top-packages.js`, `detect-false-positives.js`, `analyze-false-positives.js`
22
+ - **Comprehensive Validation Report**: [VALIDATION.md](./VALIDATION.md) with detection rates, FP metrics, and per-detector performance
23
+
24
+ ### Changed
25
+ - **Major Version Bump**: v0.18.3 v1.0.0 production-grade release with published validation metrics
26
+ - **Tool Description**: Updated with 100% campaign detection / 0% FP rate claims
27
+ - **D1 (Typosquat) Threshold**: Increased to 85 to eliminate 46 false positives on legitimate scoped sub-packages
28
+ - **D7 (Obfuscation) Threshold**: Raised to 75 post-calibration; reduces false positives on bundlers (webpack, esbuild) by 82%
29
+
30
+ ### Fixed
31
+ - Graceful fallback when npm registry unavailable (D6 uses pattern-only heuristics)
32
+ - Encoding fix: All JSONL reads/writes now explicitly use `utf-8` encoding for Windows compatibility
33
+ - False positive guard: Palindrome check in D7 no longer flagged as obfuscation
34
+
35
+ ### Docs
36
+ - Added [VALIDATION.md](./VALIDATION.md): Full detection rates, false positive analysis, threshold justification
37
+ - Updated README with validation summary and per-detector confidence table
38
+
39
+ ### Tests
40
+ - 690 tests total (671 pass, 0 fail, 19 skip)
41
+ - Zero regressions post-validation
42
+
43
+ ## v0.18.2 — June 2, 2026
44
+
45
+ ### New Detectors
46
+ - **D6a** `tier1-version-confusion.js` Detects dependency confusion via sentinel
47
+ versions (99.99.99 family HIGH) and high-version heuristic (major≥9 MEDIUM).
48
+ Covers Sonatype-2026-003429 and Microsoft scope confusion campaigns.
49
+ - **D6b** `tier1-multistage-postinstall.js` Detects two-stage remote download +
50
+ binary execution and detached background persistence in lifecycle scripts.
51
+ Covers Gen-2 stager patterns from the OpenSearch/ES typosquatting wave.
52
+ - **D6c** `tier1-cloud-imds.js`Detects GCP metadata server and Azure IMDS endpoint
53
+ targeting in scripts and JS files. Covers the Miasma @redhat-cloud-services campaign.
54
+
55
+ ### Detector Enhancements
56
+ - **D2** `tier1-infostealer.js` Added NAMED_SIGNATURES array with early-return
57
+ CRITICAL detection for confirmed malware campaign strings. First entry: Miasma
58
+ campaign identifier (June 2026).
59
+
60
+ ### Bug Fixes
61
+ - **D6b** `tier1-multistage-postinstall.js`
62
+ - Removed /g flag from REMOTE_FETCH_RE, BINARY_EXEC_RE, DETACHED_RE
63
+ eliminated fragile lastIndex state between hook iterations
64
+ - Added critical severity tier to severityLabel Signal A+B findings
65
+ now consistently report severity: critical / confidence: CRITICAL
66
+ - Fixed hardcoded "postinstall" in finding message now reflects
67
+ whichever hook fired and the subtype string
68
+
69
+ ### Infrastructure
70
+ - Added Detector Registry section to AGENTS.md with calibration notes.
71
+
72
+ ### Test Suite
73
+ - 656 passing, 0 failing, 19 skipping.
74
+
75
+ ### Added
76
+ - `scan --file <path>` flag to analyze local `.tgz` tarballs without fetching from npm registry
77
+ - `scan --fail-on <level>` flag to exit with code 1 when findings >= severity (CI/CD integration)
78
+ - `scan --sarif [file]` to output SARIF v2.1 format for GitHub Advanced Security, VS Code, Azure DevOps
79
+ - `scan --csv [file]` and `report --csv [file]` to export tabular CSV for Excel/Sheets import
80
+ - `scan --score-only` to output only risk score (0-10), auto-added to JSON output
81
+ - Government/SOC 2 features: `--audit-log`, `--fips`, `--stig`, `--cache-dir` for air-gapped/federal compliance
82
+ - **BYOC (Bring Your Own Cloud)**: Helm chart v1.0.0 for enterprise/government VPC deployments with SIEM, PDF, SSO
83
+
84
+ ## [0.9.7] 2026-05-12
85
+
86
+ - Sigstore provenance attestation on every publish via new GitHub Actions workflow
87
+ - Fix duplicate Docker section in README.md
88
+ - Add SECURITY.md with vulnerability disclosure policy and PGP key
89
+
90
+ ## [0.9.6] — 2026-05-12
91
+
92
+ - Add Docker badge (`ghcr.io/lateos/npm-scan`) to all 5 READMEs
93
+ - Add dedicated Docker quick-start section in all languages
94
+ - Replace duplicate Docker pull instructions in Integrations with cross-references
95
+
96
+ ## [0.9.5] — 2026-05-12
97
+
98
+ - Fix literal `\n` escape sequences in LICENSING.md (replaced with real newlines)
99
+
100
+ ## [0.9.4] — 2026-05-11
101
+
102
+ - Fix language badge links to use absolute GitHub URLs so they work from npm web UI
103
+ - Fix GitHub organization links from `lateos` to `lateos-ai` across all READMEs
104
+
105
+ ## [0.9.3] — 2026-05-11
106
+
107
+ - Add multi-language README: Chinese (`README.zh.md`), Japanese (`README.ja.md`), French (`README.fr.md`), German (`README.de.md`)
108
+ - Language-switcher badges with absolute GitHub URLs in all 5 READMEs
109
+
110
+ ## [0.9.2] — 2026-05-11
111
+
112
+ - **222 tests across 8 test files** (212 passing, 10 skipped for known FPs)
113
+ - **85% line coverage** with Node.js native test runner
114
+ - New test files: `test/db.test.js`, `test/detectors-edge-cases.test.js`, `test/detectors-corpus.test.js`, `test/report-snapshots.test.js`, `test/fetch.test.js`, `test/policy-edge-cases.test.js`, `test/cli.test.js`, `test/fixtures/mock-data.js`
115
+ - `backend/db.js:close()` resets `initPromise = null` for test isolation
116
+ - GitHub Actions CI with Node 18/20/22 matrix, corpus tests, and self-scan
117
+ - GitHub Actions PR lockfile scanner with `fail-on: high`
118
+
119
+ ## [0.9.1] — 2026-05-11
120
+
121
+ - Remove `node-fetch` import and dependency (replaced in 0.9.0)
122
+
123
+ ## [0.9.0] — 2026-05-11
124
+
125
+ - **Replace `node-fetch` with native `fetch`** (Node 18+) — removes external HTTP dependency
126
+ - **Replace `better-sqlite3` with `sql.js`** (WASM) — zero native compilation, fixes `npx` silent failure on systems without build tools
127
+ - Add 404 check in `backend/fetch.js` for robust registry lookups
128
+ - Reduce ATK-009 false positives on `lodash`/`axios`/`express`
129
+ - Fix ATK-002/011 false positives stricter eval+decode rules, remove self-referential checks
130
+ - Fix ATK-008 `knownRepos` for `vue`
131
+
132
+ ## [0.8.0] — 2026-05-11
133
+
134
+ - **YAML/JSON policy-as-code engine** — allowlists, severity overrides, suppressions, `fail_on` threshold
135
+ - **Text report generator** (free tier)
136
+ - **PDF report generator** (premium, via `pdf-lib`)
137
+ - **Docker**: multi-stage builds, Compose profiles, health checks, validation script, Makefile
138
+ - Comprehensive README rewrite with comparison table, ATK taxonomy, usage examples, integrations
139
+ - `.npmignore` cleanup for smaller package
140
+
141
+ ## [0.7.6]2026-05-10
142
+
143
+ - **GitHub Action** (`action.yml`) scan on push/PR with lockfile or package mode, fail-on severity threshold, SIEM/SBOM output support
144
+ - **28 comprehensive tests** covering SIEM exporters (CEF, ECS, Sentinel, QRadar), EU CRA compliance, SBOM (CycloneDX + SPDX), License key gen/validation/edition/tamper/expiry, Report/NIST (HTML, SR-series table, severity badges, all 11 ATK IDs)
145
+ - Fix tampered key test determinism
146
+
147
+ ## [0.7.5] 2026-05-10
148
+
149
+ - Add Elastic ECS, Microsoft Sentinel, and IBM QRadar SIEM exporters
150
+
151
+ ## [0.7.4] 2026-05-10
152
+
153
+ - Version bump only; no functional changes
154
+
155
+ ## [0.7.3] — 2026-05-10
156
+
157
+ - Version bump only; no functional changes
158
+
159
+ ## [0.7.2] — 2026-05-10
160
+
161
+ - Fix duplicate Enterprise Features section in README
162
+
163
+ ## [0.7.1] 2026-05-10
164
+
165
+ - Add SAML SSO and REST API sections to README
166
+
167
+ ## [0.7.0] — 2026-05-10
168
+
169
+ - **Enterprise SAML SSO integration**
170
+
171
+ ## [0.6.0] — 2026-05-10
172
+
173
+ - **License key enforcement** HMAC-signed keys with community/premium/enterprise editions
174
+ - Feature gating for SIEM, CRA, REST API, Helm, PostgreSQL backend, SSO, audit logs
175
+ - **PostgreSQL schema** teams, users, RBAC, audit log, webhooks, API keys, materialized `package_risk` view
176
+ - **FastAPI REST API** — scan/list/retrieve endpoints, webhook CRUD with HMAC-signed dispatch
177
+ - **Webhook engine** event dispatch with retry, signature verification header
178
+ - **Helm chart** API + worker + PostgreSQL deployments, secrets, ingress, PVC
179
+ - CLI hardened: premium features blocked without valid license key
180
+
181
+ ## [0.5.0] — 2026-05-10
182
+
183
+ - **ATK-011 (Transitive Propagation)** detector
184
+ - **SIEM CEF export** for Splunk and ArcSight integration
185
+ - **EU CRA compliance report** — EU Cyber Resilience Act readiness assessment
186
+ - Phase 3 enterprise foundation
187
+
188
+ ## [0.4.1]2026-05-10
189
+
190
+ - Update README for Phase 3 (ATK-011, SIEM, CRA)
191
+
192
+ ## [0.4.0] — 2026-05-10
193
+
194
+ - **ATK-008 (Tarball Tampering)**, **ATK-009 (Dormant Trigger)**, **ATK-010 (Sandbox Evasion)** detectors
195
+ - **SPDX 2.3 SBOM** support alongside CycloneDX
196
+ - **NIST SP 800-161 compliance report** — supply chain risk management controls
197
+ - Sandbox threat model and gVisor isolation strategy
198
+
199
+ ## [0.3.3] — 2026-05-10
200
+
201
+ - Fix report HTML/SBOM generation to use `atk_id`, description, package name, dynamic version
202
+
203
+ ## [0.3.2] — 2026-05-10
204
+
205
+ - Update README for Phase 2 (ATK-008–010, SPDX, NIST)
206
+
207
+ ## [0.3.1] 2026-05-10
208
+
209
+ - Fix schema literal newlines
210
+ - Fix CLI SBOM defaults
211
+ - Fix SBOM finding IDs
212
+
213
+ ## [0.3.0] — 2026-05-10
214
+
215
+ - **ATK-001 (Lifecycle Script)** detector — detects `preinstall`, `postinstall`, `preuninstall` hooks with suspicious commands
216
+ - **ATK-002 (Obfuscated Payload)** detector — hex/base64/decode-driven eval, regex obfuscation
217
+ - **ATK-003 (Credential Harvester)** detectorenv var exfiltration, filesystem credential scraping
218
+ - **ATK-004 (Persistence Mechanism)** detector cron jobs, startup scripts, `postinstall` service installs
219
+ - **ATK-005 (Data Exfiltration)** detector DNS tunneling, HTTP beaconing, unexpected network calls
220
+ - **ATK-006 (Dependency Confusion)** detector — internal package name heuristics
221
+ - **ATK-007 (Typosquatting)** detector — edit-distance based package name similarity
222
+
223
+ ## [0.2.5] — 2026-05-10
224
+
225
+ - Fix `.npmignore` to exclude corpus tarballs from published package
226
+
227
+ ## [0.2.4] — 2026-05-10
228
+
229
+ - Version bump only; no functional changes
230
+
231
+ ## [0.2.2] 2026-05-10
232
+
233
+ - **Corpus test suite** — 50 clean packages (0% FP) + 22 malicious PoC (100% detect rate)
234
+ - **HTML report generator** with CLI `--html` flag
235
+ - ATK-007 edit-distance typosquatting implementation
236
+ - Switch from `adm-zip` to `tar` for tgz extraction
237
+ - ATK detectors hardened for fewer false positives
238
+ - `README.md`, `.gitignore`, corpus download scripts
239
+ - **Phase 1 exit**: FP < 2%, passes unit tests + corpus
240
+
241
+ ## [0.2.1] — 2026-05-10
242
+
243
+ - Version bump only; no functional changes
244
+
245
+ ## [0.2.0] — 2026-05-10
246
+
247
+ - **Commander.js CLI** with `scan`, `scan-lockfile`, `report` commands
248
+ - **ATK-001–007 detector stubs** via `backend/detectors/index.js` (`runAll`)
249
+ - **SQLite persistence** via `better-sqlite3` — scan auto-save, report by ID/recent
250
+ - **CycloneDX SBOM** — JSON and XML output with ATK vulnerability references
251
+ - `.github/workflows/scan.yml` — GitHub Action example for PR scanning
252
+ - Dependencies: `commander`, `adm-zip`, `acorn`, `node-fetch`
253
+
254
+ ## [0.1.0] — 2026-05-09
255
+
256
+ - **Initial foundation**
257
+ - Monorepo structure (`cli/`, `backend/`, `docker/`, `docs/`)
258
+ - `LICENSING.md` — Apache-2.0 core + Commons Clause for premium features
259
+ - `CONTRIBUTING.md`
260
+ - `docs/attack-taxonomy.md` — ATK-001 through ATK-011 stubs
261
+ - `backend/license.js` skeleton for HMAC-signed license key gating
262
+ - `backend/db/schema.sql`
263
+ - `docker/Dockerfile.cli` + `docker-compose.yml`
264
+ - npm scripts (lint, test stubs)
265
+ - `.github/workflows/ci.yml`
234
266
  - `AGENTS.md` — project instructions
package/LICENSING.md CHANGED
@@ -1,19 +1,19 @@
1
- # LICENSING.md
2
-
3
- ## Model: Apache-2.0 core + Commons Clause premium
4
-
5
- ### Core (Apache-2.0):
6
- - Static analysis engine, ATK-001–007 detectors, CLI, lockfile scanner, SBOM output (CycloneDX), GitHub Action, Docker images, JSON output, SQLite-backed local storage, basic HTML report.
7
-
8
- ### Premium (Apache-2.0 + Commons Clause):
9
- - Dynamic sandbox (ATK-008+), advanced compliance reports (PDF, regulatory templates), SIEM connectors, reachability analysis, team dashboard, SSO, audit logs, API/webhooks, on-prem/air-gapped licenses, priority support.
10
-
11
- ## Commons Clause
12
- The Commons Clause prohibits selling our open core software as a service. See https://commonsclause.com/ for details.
13
-
14
- ## Feature Flags
15
- Premium features gated by license key validated at runtime. Keys issued per-seat CLI, per-org hosted.
16
-
17
- Full Apache-2.0 license in LICENSE file (TBD).
18
-
19
- Licensing boundaries defined before external contributions. Changes require PR updating this file.
1
+ # LICENSING.md
2
+
3
+ ## Model: Apache-2.0 core + Commons Clause premium
4
+
5
+ ### Core (Apache-2.0):
6
+ - Static analysis engine, ATK-001–007 detectors, CLI, lockfile scanner, SBOM output (CycloneDX), GitHub Action, Docker images, JSON output, SQLite-backed local storage, basic HTML report.
7
+
8
+ ### Premium (Apache-2.0 + Commons Clause):
9
+ - Dynamic sandbox (ATK-008+), advanced compliance reports (PDF, regulatory templates), SIEM connectors, reachability analysis, team dashboard, SSO, audit logs, API/webhooks, on-prem/air-gapped licenses, priority support.
10
+
11
+ ## Commons Clause
12
+ The Commons Clause prohibits selling our open core software as a service. See https://commonsclause.com/ for details.
13
+
14
+ ## Feature Flags
15
+ Premium features gated by license key validated at runtime. Keys issued per-seat CLI, per-org hosted.
16
+
17
+ Full Apache-2.0 license in LICENSE file (TBD).
18
+
19
+ Licensing boundaries defined before external contributions. Changes require PR updating this file.