vigievuln 1.1.2 → 1.2.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 (107) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +51 -141
  3. package/completions/vigievuln.bash +1 -1
  4. package/completions/vigievuln.zsh +1 -0
  5. package/lib/account-client.js +21 -14
  6. package/lib/account-session.js +6 -2
  7. package/lib/advisory-compression.js +25 -0
  8. package/lib/advisory-fixes.js +21 -0
  9. package/lib/advisory-store-sqlite.js +156 -0
  10. package/lib/advisory-store.js +484 -0
  11. package/lib/airgap-project.js +117 -0
  12. package/lib/application-plugins/runner.js +22 -13
  13. package/lib/application-plugins/wordpress.js +4 -3
  14. package/lib/application-providers/live-snapshot.js +1 -12
  15. package/lib/application-providers/snapshot-cache.js +27 -0
  16. package/lib/application-providers/wordfence-client.js +3 -3
  17. package/lib/attribution.js +2 -2
  18. package/lib/cache-archive-sqlite.js +215 -0
  19. package/lib/cache-archive.js +357 -26
  20. package/lib/cache-db.js +142 -0
  21. package/lib/cache-directory.js +18 -74
  22. package/lib/cache-policy.js +25 -0
  23. package/lib/cache-repository.js +48 -0
  24. package/lib/cache-startup.js +54 -0
  25. package/lib/certfr.js +9 -9
  26. package/lib/cli-command-routing.js +29 -6
  27. package/lib/cli-groups.js +32 -3
  28. package/lib/cli-project-commands.js +47 -6
  29. package/lib/cli-setup.js +300 -0
  30. package/lib/codecs/binary/pe-metadata.js +79 -0
  31. package/lib/codecs/binary/scan.js +4 -3
  32. package/lib/codecs/binary.codec.js +4 -2
  33. package/lib/codecs/composer/registry.js +8 -6
  34. package/lib/codecs/go/parse.js +7 -9
  35. package/lib/codecs/go/registry.js +7 -5
  36. package/lib/codecs/go.codec.js +5 -0
  37. package/lib/codecs/maven.codec.js +73 -8
  38. package/lib/codecs/npm/collect.js +12 -5
  39. package/lib/codecs/npm/parse.js +12 -5
  40. package/lib/codecs/npm/registry.js +42 -12
  41. package/lib/codecs/nuget/registry.js +8 -6
  42. package/lib/codecs/pypi/registry.js +8 -6
  43. package/lib/codecs/ruby/registry.js +7 -5
  44. package/lib/compression-dictionary.js +5 -0
  45. package/lib/coverage-diagnostics.js +26 -0
  46. package/lib/cve-download.js +157 -41
  47. package/lib/cve-legacy-ranges.js +59 -0
  48. package/lib/cve-match.js +85 -17
  49. package/lib/cve-npm-proxy.js +29 -0
  50. package/lib/cve-report.js +145 -58
  51. package/lib/cve-version-verdict.js +77 -0
  52. package/lib/deps-descriptor.js +8 -3
  53. package/lib/epss.js +13 -8
  54. package/lib/euvd.js +32 -8
  55. package/lib/gcve-feed.js +103 -0
  56. package/lib/gcve-index.js +181 -0
  57. package/lib/gcve.js +1 -1
  58. package/lib/github-publisher-maven.js +40 -0
  59. package/lib/hash-id.js +5 -5
  60. package/lib/hosted-proxy.js +6 -1
  61. package/lib/i18n.js +31 -8
  62. package/lib/json-cache.js +18 -0
  63. package/lib/json-export.js +16 -2
  64. package/lib/kev.js +7 -8
  65. package/lib/line-stream.js +23 -0
  66. package/lib/maven-airgap.js +80 -0
  67. package/lib/maven-cache.js +21 -0
  68. package/lib/maven-license.js +2 -1
  69. package/lib/maven-presence.js +2 -2
  70. package/lib/maven-reactor.js +23 -14
  71. package/lib/maven-repo.js +11 -6
  72. package/lib/merge-sources.js +25 -18
  73. package/lib/native-advisories.js +268 -0
  74. package/lib/nvd-bulk.js +145 -0
  75. package/lib/nvd-package-ranges.js +109 -0
  76. package/lib/nvd.js +52 -24
  77. package/lib/osv-db.js +253 -59
  78. package/lib/osv-legacy.js +57 -0
  79. package/lib/osv.js +241 -168
  80. package/lib/outdated.js +11 -12
  81. package/lib/package-metadata.js +141 -0
  82. package/lib/package-versions.js +52 -0
  83. package/lib/packagist-audit.js +6 -6
  84. package/lib/provenance.js +73 -19
  85. package/lib/providers/common.js +11 -1
  86. package/lib/providers/gcve.js +17 -0
  87. package/lib/providers/github.js +1 -0
  88. package/lib/providers/index.js +49 -26
  89. package/lib/providers/vigievuln.js +7 -0
  90. package/lib/proxy-cache.js +1 -1
  91. package/lib/proxy-scope.js +59 -0
  92. package/lib/proxy-throttle.js +71 -0
  93. package/lib/resource-cache/engine.js +36 -9
  94. package/lib/resource-cache/sqlite-store.js +95 -0
  95. package/lib/resource-cache/validate.js +5 -0
  96. package/lib/retire.js +24 -24
  97. package/lib/ruby-version.js +36 -0
  98. package/lib/sarif-export.js +1 -1
  99. package/lib/sbom-export.js +11 -7
  100. package/lib/snyk.js +32 -20
  101. package/lib/source-profile.js +67 -0
  102. package/lib/sqlite-driver.js +46 -0
  103. package/lib/transitive.js +69 -34
  104. package/lib/unmanaged.js +2 -1
  105. package/lib/vigievuln-advisories.js +47 -0
  106. package/package.json +7 -6
  107. package/vigievuln.js +380 -107
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog — VigieVuln
2
2
 
3
+ ## [1.2.0] — Unreleased
4
+
5
+ - Match VigieVuln Maven/npm advisories through the configured official proxy and offline cache, including partial ranges and `VV:CVE-…` identifiers.
6
+ - Revalidate local caches after four hours, or on demand with `--force-update`; retain offline snapshots and avoid redownloading unchanged CVE releases.
7
+ - Keep source-wide coverage limits and the Maven depth setting in methodology; report project-specific gaps separately.
8
+
9
+ - Store local advisories, source catalogues, registry answers, resource bodies and proxy caches in SQLite. Bundles carry one preindexed database with compressed advisory bodies and a shared symbol dictionary; the transfer remains gzip-compressed. Old filesystem caches are removed on startup, while configuration and account sessions are preserved. Node.js 22.13+, 23.4+ and 24+ use the built-in SQLite module.
10
+ - Add interactive `setup` for source policies, proxy login and authenticated cache initialisation; existing installations retain unrestricted sources by default.
11
+ - Seed version-independent OSV and GCVE advisory data for matching at scan time, including offline scans, with source provenance and incomplete-coverage warnings.
12
+ - Preserve observed public Maven POMs and npm manifests by version in the seed; refuse conflicting observations and retain existing private repository precedence.
13
+ - Collect independent GCVE records conservatively, preserving typed relationships and reporting only supported package identities and version comparisons.
14
+ - Show unverified PE version metadata in the native-binary inventory and document its CVE correlation limitations.
15
+ - Preserve advisory source attribution through CVEProject, OSV and Snyk merges; use `cache` when the upstream source is unavailable.
16
+ - Avoid treating inclusive affected-version bounds or advisories with no known fix as verified remediation targets.
17
+
18
+ ## [1.1.3] — 2026-10-29
19
+
20
+ - Reuse fresh proxy-confirmed responses locally for up to one hour, and preserve stale-source warnings when refresh fails.
21
+ - Allow up to 100 hosted proxy requests per second, respecting server rate limits and retry delays.
22
+ - Select the official proxy on login when no proxy is configured; retain an existing proxy selection.
23
+ - Improve hosted scans, report links, account and cache handling, and Maven presence validation.
24
+ - Trim whitespace around Maven versions before OSV lookups so one malformed value cannot reject a whole batch.
25
+ - Refresh the example audit reports and their screenshot.
26
+ - Send the CLI version to the hosted proxy and explain how to update when the server requires a newer version.
27
+
3
28
  ## [1.1.2] — Unreleased
4
29
 
5
30
  - Fix Windows account sessions when the home directory uses an 8.3 short path, including GitHub Actions temporary directories.
package/README.md CHANGED
@@ -10,23 +10,23 @@
10
10
  [![CI](https://github.com/9pings/VigieVuln/actions/workflows/ci.yml/badge.svg)](https://github.com/9pings/VigieVuln/actions/workflows/ci.yml)
11
11
 
12
12
 
13
- **VigieVuln** (formerly `fad-checker`) is a polyglot dependency auditor built for **professional code audits**.
13
+ **VigieVuln** is a polyglot dependency auditor built for **professional code audits**.
14
14
 
15
- It scans **10 ecosystems + 9 CMS/Frameworks** (WordPress, Drupal, Symfony, Laravel…) in one pass, with **no build tools**, support **air-gapped** workflows using transferred caches, private package detection, committed binaries & certificates, then produces clean **HTML reports + json baseline + (DOC/XLSX/SARIF/CycloneDX/etc)** .
15
+ It scans dependencies and **9 CMS/frameworks** in one pass without build tools, supports **air-gapped** workflows, detects private packages, binaries and certificates, and produces HTML, JSON and other reports.
16
16
 
17
17
 
18
18
  🌐 **[Project site & docs →](https://9pings.github.io/VigieVuln/)**
19
19
 
20
- *Demo and sample reports generated with VigieVuln 1.0.1.*
20
+ *Terminal demo recorded with VigieVuln 1.0.1.*
21
21
 
22
22
  <p align="center"><img src="docs/assets/demo.gif" alt="vigievuln animated terminal demo: an offline Maven audit — dependencies absent from Maven Central flagged as private/internal, the compact single-line vulnerability-database progress, then findings coloured by severity" height="500"></p>
23
23
 
24
24
  ## Features
25
25
 
26
- - **10 ecosystems in one pass**; Maven, Gradle, npm/Yarn/pnpm, Composer, PyPI, NuGet, Go, Ruby — plus **vendored JS**, committed **native binaries** (identified by checksum) and **embedded JARs** (fat-jars/war/ear, opened in-memory).
26
+ - **Multiple ecosystems in one pass**: Maven and Gradle, npm/Yarn/pnpm, Composer, PyPI, NuGet, Go and Ruby — plus **vendored JS**, committed **native binaries** and **embedded JARs**.
27
27
  - **No build tools**; No `mvn`/`gradle`/`npm`/`pip`/`dotnet`/`go`, no `node_modules/` → [how](docs/COMPARISON.md#how-its-autonomous-no-build-tools)
28
28
  - **CVE from multiple sources, merged & prioritised**; CVEProject + OSV.dev + Packagist security advisories + NVD, ranked **CISA KEV → EPSS → CVSS**.
29
- - **European references on every CVE**: ENISA **EUVD** id + ENISA's exploited flag, **GCVE** id, and the **CERT-FR** advisories citing it. Hosted proxy lookups send relevant CVE identifiers to the proxy.
29
+ - **European vulnerability references**: ENISA **EUVD** id + ENISA's exploited flag, **GCVE** id, and the **CERT-FR** advisories citing it. Hosted proxy lookups send relevant CVE identifiers to the proxy.
30
30
  - **Beyond CVEs**; Report **EOL and out-of-active-support** frameworks, deprecated/abandoned/yanked, outdated, SPDX **licenses**, and **private/internal packages**
31
31
  - **CMS & frameworks audited as instances**; Symfony, Laravel, WordPress, Drupal, Joomla, PrestaShop, TYPO3, Magento/Adobe Commerce and SPIP with per-instance inventory (core, plugins, themes, bundles, components) → [the dedicated guide](docs/CMS-FRAMEWORKS.md)
32
32
  - **Crypto material**; committed **certificates**, **private vs public keys** across PEM/OpenSSH/PuTTY/PGP and JKS/PKCS#12 keystores.
@@ -43,18 +43,6 @@ It scans **10 ecosystems + 9 CMS/Frameworks** (WordPress, Drupal, Symfony, Larav
43
43
 
44
44
  📖 **[Usage & all flags](docs/USAGE.md)** · **[Architecture](docs/ARCHITECTURE.md)** · **[Comparison vs other tools](docs/COMPARISON.md)** · **[Data sources](docs/DATA-SOURCES.md)**
45
45
 
46
- ## Migration from fad-checker
47
-
48
- The npm package and primary command are now `vigievuln`. Existing `fad` and
49
- `fad-checker` commands remain aliases. The default cache and configuration directory is `~/.vigie-vuln/`. If it does not exist, an existing `~/.fad-checker/` is automatically renamed to it. If the new directory already exists, it is kept. If the rename fails, a new directory is created and execution continues; the old directory is not merged.
50
- The separate shared proxy cache similarly migrates from `~/.fad-checker-proxy-cache/` to `~/.vigie-vuln-proxy-cache/` without merging or overwriting an existing new directory. If either rename fails, the CLI warns you, preserves the old directory and uses a new one. Existing cache archives made with `.fad-checker` remain importable.
51
-
52
- To recover a failed migration, stop the CLI and proxy server, back up and move the new directory out of the way, then rename the old directory to the new name. Remove the corresponding sibling marker, `~/.vigie-vuln.migration-pending` or `~/.vigie-vuln-proxy-cache.migration-pending`, after recovery. Do not overwrite or merge the directories. While both the marker and old directory exist, the warning repeats once per process; if the marker could not be created, only the immediate warning is assured.
53
- `VIGIEVULN_ENV` takes precedence over the legacy `FAD_CHECKER_ENV`. Project
54
- configuration is loaded only when explicitly selected with `--config` and must be trusted.
55
- Default report output is now
56
- `./vigievuln-report`; pass `-o` to retain another location.
57
-
58
46
  ## Quick start
59
47
 
60
48
  ```bash
@@ -66,67 +54,48 @@ A free [NVD API key](https://nvd.nist.gov/developers/request-an-api-key) (instan
66
54
 
67
55
  ### Monitor a project
68
56
 
69
- Create and verify your [account](https://www.vigievuln.fr/account), then sign in and explicitly accept the [terms of service dated 2026-10-28](https://www.vigievuln.fr/terms) when prompted:
70
-
71
- ```bash
72
- vigievuln login
73
- vigievuln whoami
74
- vigievuln watch ./project --name 'My Project'
75
- vigievuln project status
76
- vigievuln logout
77
- ```
78
-
79
- `watch` collects the inventory locally and uploads it once. Run it again with the same unique project name to update that project's inventory; it does not run a background watcher. `login` creates an account session and does not configure the proxy cache.
80
-
81
- The free tier includes **one project and up to 100 distinct direct dependency coordinates per project**. Multiple versions of the same coordinate count once. An uploaded descriptor may be at most **500,000 bytes (0.5 MB decimal)**; an upload exceeding this size or 100 distinct direct coordinates is rejected with an error. Dependencies whose direct relationship cannot be established are excluded from monitoring and reported as incomplete coverage. These limits apply to hosted monitoring, not local scans.
82
-
83
- Free monitoring expires **one calendar month (UTC)** after a successful `watch` upload. Each successful upload, including a project API push, renews the period for one calendar month (UTC). At expiry, the hosted project and its monitoring data are purged and an expiry email is sent; the account remains. Copies in backups are not deleted immediately.
84
-
85
- If the current terms have not been accepted, the CLI displays their link and asks for explicit acceptance in an interactive terminal. For non-interactive use, run `vigievuln login` interactively and accept the terms first.
86
-
87
- To review the inventory before uploading, export it locally:
57
+ Monitor your project's direct dependencies for new high, critical or known exploited vulnerabilities. Create and verify a [Vigie Vuln account](https://www.vigievuln.fr/account) first.
88
58
 
89
59
  ```bash
90
- vigievuln watch ./project --export fichier.json
60
+ vigievuln login # sign in and accept the terms
61
+ vigievuln watch ./project --export deps.json # optional: review the inventory locally
62
+ vigievuln watch ./project --name 'My Project' # upload or update the project
63
+ vigievuln project status # check the monitoring status
91
64
  ```
92
65
 
93
- `--export` only writes the descriptor: it runs offline, requires no login, sends nothing to the service and does not renew monitoring. Review package names and versions, including private packages, before uploading. Source code, paths and registry URLs are omitted from the descriptor.
94
-
95
- Monitoring establishes a silent initial baseline, then reports new high or critical vulnerabilities (CVSS ≥ 7) and known exploited vulnerabilities affecting direct dependencies. Enable alerts in your account and refresh the inventory when dependencies change. [Monitoring workflow and compatibility commands](docs/USAGE.md#project-monitoring).
96
-
97
- Existing commands remain supported: `vigievuln -s ./code`, `auth login|status|logout`, `--prepare-project` and `project push`.
66
+ Review the inventory before sharing, enable alerts in your account and upload again when dependencies change. The free tier covers one project, 100 direct coordinates and a 0.5 MB descriptor; each upload renews monitoring for one month. [Monitoring guide](docs/USAGE.md#project-monitoring).
98
67
 
99
68
  ### Official Vigie Vuln proxy cache
100
69
 
101
- Configure the proxy once, then sign in with your verified [Vigie Vuln account](https://www.vigievuln.fr/account) when prompted:
70
+ Use [Vigie Vuln DB](https://www.vigievuln.fr/) as a European-hosted source for scans, including reviewed VigieVuln advisories for Maven and npm.
102
71
 
103
72
  ```bash
104
- vigievuln --set-proxy-cache vigievuln # `default` selects the same official proxy
105
- vigievuln scan ./code
73
+ vigievuln login # sign in and select the official proxy if none is configured
74
+ vigievuln scan ./code # scan using the saved proxy and key
75
+ vigievuln setup --mode direct --sources all # switch back to direct sources
106
76
  ```
107
77
 
108
- The selection and the proxy key created during proxy sign-in are saved in `~/.vigie-vuln/config.json` and reused on subsequent scans. This proxy key is separate from the account session used by `watch`. Alternatively, save an existing key with `vigievuln --set-proxy-cache-token <key>`, or provide it via `VIGIEVULN_PROXY_CACHE_TOKEN` (useful in CI). Remove the selection or key with `--unset-proxy-cache` or `--unset-proxy-cache-token`. `--proxy-cache <url>` overrides the saved selection for one scan. The hosted proxy receives requested package coordinates and CVE identifiers; it does not receive your source code. [Proxy documentation](docs/USAGE.md#hosted-vigievuln-proxy).
78
+ The proxy receives package coordinates and CVE identifiers, not source code. Cached advisories remain usable offline; partial version evidence leaves other versions unknown. [Proxy guide](docs/USAGE.md#hosted-vigievuln-proxy).
109
79
 
110
80
  ### Interactive HTML samples
111
81
 
112
- - **[Apache Dubbo 2.7.8 — open the report](https://9pings.github.io/VigieVuln/samples/dubbo.html)**: the project used for the report screenshot below, rescanned with VigieVuln 1.0.1; 105 Maven descriptors, direct/transitive CVEs, KEV matches, EOL and fix recommendations.
82
+ - **[Apache Dubbo 2.7.8 — open the report](https://9pings.github.io/VigieVuln/samples/dubbo.html)**: the project used for the report screenshot below, rescanned with VigieVuln 1.1.3; 105 Maven descriptors, direct/transitive CVEs, KEV matches, EOL and fix recommendations.
113
83
  - **[Multi-instance CMS & frameworks — open the report](https://9pings.github.io/VigieVuln/samples/multi-cms-frameworks.html)**: WordPress 6.4.2, Drupal 8.5.0, Symfony Demo (Symfony 7.1.1) and BookStack v24.10 (Laravel 10.48.22), with findings attributed to each instance.
114
84
 
115
- These are standalone reports from real source scans, generated offline on **2026-10-26** using the local cache. The CMS sample focuses on PHP dependencies; WordPress advisory coverage is explicitly incomplete without a Wordfence feed. [Sample scope, sources and reproduction commands](docs/samples/README.md).
85
+ These are standalone reports from real source scans, generated on **2026-10-29** using the hosted proxy and local caches. The CMS sample focuses on PHP dependencies; WordPress advisory coverage is explicitly incomplete without a Wordfence feed. [Sample scope, sources and reproduction commands](docs/samples/README.md).
116
86
 
117
87
  > [!WARNING]
118
88
  > vigievuln is new and may still contain ( rare ) bugs. Treat its output as a strong first pass, **double-check anything critical**, and please [report issues](https://github.com/9pings/VigieVuln/issues); they get fixed fast.
119
89
 
120
90
  ## Why use vigievuln for code audits?
121
91
 
122
- What it does for an audit that the others don't. Same column set and sourcing discipline as
123
- [`docs/COMPARISON.md`](docs/COMPARISON.md) — `⚠️` is *partial* and says how, cells are meant to be
124
- checkable.
92
+ An author-maintained comparison of audit workflows; see [`docs/COMPARISON.md`](docs/COMPARISON.md)
93
+ for versions, sources and limitations. `⚠️` indicates partial or conditional support.
125
94
 
126
- | What an auditor actually needs to do | **fad** | OSV | Trivy | Grype+Syft | OWASP DC | Snyk |
95
+ | What an auditor actually needs to do | **VigieVuln** | OSV | Trivy | Grype+Syft | OWASP DC | Snyk |
127
96
  | ------------------------------------------------------------------------------------------ | :-: | :-: | :-: | :-: | :-: | :-: |
128
97
  | Audit a **100-module polyglot monorepo in one command**, with **no toolchain installed** | ✅ 105 modules | ⚠️ reactor skipped | ⚠️ needs `~/.m2` | ⚠️ opt-in | ⚠️ Java build | ⚠️ `mvn` build |
129
- | **Scan offline / air-gapped without dropping transitive deps** | ✅ 657/657 | ❌ | ⚠️ `~/.m2` | ⚠️ opt-in | ⚠️ mirror | ❌ |
98
+ | **Scan offline / air-gapped with cached data** | ⚠️ cached metadata | ⚠️ limited | ⚠️ `~/.m2` | ⚠️ opt-in | ⚠️ mirror | ❌ |
130
99
  | **Identify the private/internal deps** across a big project | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
131
100
  | **Extract cleaned deps descriptors** into an external directory | ✅ `-t` | ❌ | ❌ | ❌ | ❌ | ❌ |
132
101
  | **Report EOL / deprecated frameworks & deps**, transitive ones included | ✅ | ⚠️ deprecated only | ⚠️ OS distros only | ❌ | ❌ | ⚠️ web UI only |
@@ -141,19 +110,21 @@ checkable.
141
110
  | **Share one cache across the fleet**, API keys server-side | ✅ `serve-cache` | ❌ | ⚠️ local DB | ⚠️ local DB | ⚠️ local DB | ⚠️ cloud |
142
111
 
143
112
 
113
+ Offline dependency resolution depends on cached metadata. In the Dubbo test, a cold advisory seed alone produced 185 groups versus 734 with warm metadata and reported missing POMs; see the [benchmark](docs/BENCHMARK.md) for scope and warnings.
114
+
144
115
  **Deliberately not a goal: reachability.** A finding is a vulnerable version on the dependency
145
116
  graph, and the report says exactly that (in Methodology) instead of guessing at call paths. Deciding
146
117
  whether the vulnerable code is reachable in *this* application is the auditor's call, made with
147
118
  application context no scanner has.
148
119
 
149
- ## More basic exemples :
120
+ ## More examples
150
121
 
151
122
  ```bash
152
123
  vigievuln -s ./proj -e "^com\.acme\." # exclude private libs (coord regex)
153
124
  vigievuln -s ./proj -t ../clean -e "^com\.acme\." # extract only: normalised descriptors, private modules flagged
154
125
  vigievuln -s ./proj -t ../clean -e "^com\.acme\." -a snyk # same extraction + scan + merge Snyk
155
126
  vigievuln -s ./proj --offline # fully offline (zero network, needs a warmed cache)
156
- vigievuln -s ./proj -a osv-db,typosquat # offline-complete OSV + typosquat
127
+ vigievuln -s ./proj -a osv-db,typosquat # OSV advisory matching + typosquat
157
128
  vigievuln -s ./proj -a licenses --fail-on high # license chapter + CI gate
158
129
  vigievuln -s ./proj --report-json --baseline last.json --fail-on-new # differential audit: fail CI on NEW findings
159
130
  vigievuln diff last.json this.json # standalone diff of two findings JSONs
@@ -163,9 +134,10 @@ vigievuln -s ./site --app-plugins wordpress --private-component wp-content/plugi
163
134
 
164
135
  > [!IMPORTANT]
165
136
  > **`--offline` reads the cache, it doesn't replace it.** On a *cold* cache there is nothing to
166
- > match against, so an offline first run legitimately reports **0 CVE / 0 EOL / 0 outdated**;
167
- > that's an empty cache, not a clean project. Warm it once (a normal online run on any project,
168
- > or `--import-cache`), then `--offline` returns the full result set with zero network calls.
137
+ > match against; an empty report is not evidence that the project is clean. Initialise it from
138
+ > a seed or warm it online, then review coverage and freshness warnings in the offline report.
139
+ > Cached advisories can match other applicable versions, but neither a partial cache nor an
140
+ > old snapshot guarantees complete or current results.
169
141
  > Air-gapped machines get their cache via [`--export-cache` / `--import-cache`](#air-gapped-audits).
170
142
 
171
143
  ## What it finds
@@ -177,7 +149,7 @@ The report keeps the six root chapters. Sub-chapters appear only when they conta
177
149
  | **0. Warnings** *(top)* | local heuristics | Missing lockfiles, unresolved Maven versions (BOM-managed), private packages absent from configured registries |
178
150
  | **Δ. Changes since baseline** *(top, with `--baseline`)* | diff vs prior JSON | New / fixed / unchanged findings per category + the list of **new production CVEs**; for repeat audits and `--fail-on-new` CI gating |
179
151
  | **1. CVE** *(X direct, Y indirect, Z dev)* | CVEProject + OSV.dev + Packagist + qualified publisher feeds + NVD/CPE | **Applications first when findings exist**; CMS/framework findings by instance and owner · **Production**; public CVE / GHSA in other prod deps, per ecosystem, per manifest, **prioritised** by CISA KEV + EPSS + CVSS · **Vendored JS vulns** ([retire.js](https://retirejs.github.io/)) — one row per physical library, linked CVEs + CWEs on the row, every advisory behind a click · **Dev** (`test`/`provided`, `dev`/`optional`/`peer`) · **Likely false positives** (CPE-filtered) |
180
- | **2. Unmanaged / unversioned components** | deps.dev + CIRCL (by checksum), retire.js, built-in X.509 | **Embedded binaries**; CVEs in libs shipped inside committed `.jar`/`.war`/`.ear` (fat-jars, shaded uber-jars) · **Native binaries** (`.dll`/`.exe`/`.so`/`.dylib`) identified by hash, flagged should-be-managed / name≠checksum / unknown / malicious · **Vendored JavaScript** inventory (jQuery, Bootstrap, …) vulnerable *or not* · **Certificates &amp; key material**; committed certs (expiry / weak key / weak signature / self-signed), **private vs public keys** (PEM/OpenSSH/PuTTY/PGP/SSH) and keystores, all parsed offline |
152
+ | **2. Unmanaged / unversioned components** | deps.dev + CIRCL (by checksum), retire.js, built-in X.509 | **Embedded binaries**; CVEs in libs shipped inside committed `.jar`/`.war`/`.ear` (fat-jars, shaded uber-jars) · **Native binaries** (`.dll`/`.exe`/`.so`/`.dylib`): available metadata and checksum evidence; metadata alone does not reliably identify a product or establish CVE applicability · **Vendored JavaScript** inventory (jQuery, Bootstrap, …) vulnerable *or not* · **Certificates &amp; key material**; committed certs (expiry / weak key / weak signature / self-signed), **private vs public keys** (PEM/OpenSSH/PuTTY/PGP/SSH) and keystores, all parsed offline |
181
153
  | **3. Maintenance / EOL** *(X EOL, Y obsolete, Z outdated)* | endoflife.date · curated + registry flags · Maven Central / npm / Packagist / PyPI / NuGet | **End-of-Life** frameworks (+ an "Out of active support" band with `--eol-support`; Symfony/Laravel grouped as one row per framework; PHP runtime when the Composer constraint proves it), split **direct** (declared / parent-POM-inherited — bump these) vs **transitive** (bump the dep that pulls them in) · **Obsolete / deprecated / abandoned / yanked** · **Outdated** (newer version available, with release dates; direct deps only) |
182
154
  | **4. Licenses** *(opt-in: `--licenses`)* | registry metadata + Maven POMs → SPDX policy | Each dep's license normalised to SPDX and classified; copyleft (GPL/AGPL/LGPL/MPL), proprietary and unknown flagged for review |
183
155
  | **5. Fix Recommendations** | computed | Per-ecosystem pin recipes: Maven `<dependencyManagement>`, Gradle `constraints { }`, npm `overrides`, yarn `resolutions`, `composer require`, `pip install`, `dotnet add package` |
@@ -207,86 +179,25 @@ vigievuln doesn't just read the `composer.json` under a WordPress or Drupal site
207
179
  | **SPIP** | core (`$spip_version_branche` in `ecrire/inc_version.php`), dist plugins (`paquet.xml`), user plugins (`paquet.xml`/legacy `plugin.xml`) | **NVD product CVEs** (`cpe:2.3:a:spip:spip`) — the only machine-readable SPIP source; plugins stay honestly not-qualified |
208
180
  | **Joomla / Magento (Adobe Commerce)** | core, extensions/modules, themes | no machine-readable publisher feed exists; components locked as Composer packages read as covered by the **dependency lanes**, the rest stays honestly **not qualified**. A Magento source distribution reports its exact version from the root `composer.json` |
209
181
 
210
- Every advisory snapshot a live lane fetches is stamped and cached in `~/.vigie-vuln/advisory-snapshots/`, carried by `--export-cache`/`--import-cache`, **warmed from the air-gapped descriptor itself** by `--import-anonymized`, and reused automatically offline — the Wordfence API key never travels to the enclave. Private/custom components are inventoried separately and never sent to any publisher. → **[the dedicated guide](docs/CMS-FRAMEWORKS.md)** · [application usage](docs/USAGE.md#application-inventory-experimental)
182
+ Every advisory snapshot a live lane fetches is stamped and cached in the local SQLite database, **prepared from the air-gapped descriptor** by `cache prepare`, and reused automatically offline — the Wordfence API key never travels to the enclave. Private/custom components are inventoried separately and never sent to any publisher. → **[the dedicated guide](docs/CMS-FRAMEWORKS.md)** · [application usage](docs/USAGE.md#application-inventory-experimental)
211
183
 
212
184
  ## Air-gapped audits
213
185
 
214
- > **Zero-data-sent guarantee.** Under `--offline`, vigievuln makes **no network calls
215
- > whatsoever**; it reads only the warmed `~/.vigie-vuln/` caches and never transmits a
216
- > dependency, path or finding off the machine. It is regression-tested
217
- > (`test/offline-guarantee.test.js`, a tripwire fetcher that throws if touched) and
218
- > auditor-reproducible: `unshare -rn node vigievuln.js -s ./proj --offline …` runs it in a
219
- > namespace with **no network interface** and yields byte-identical findings. Unlike the
220
- > mainstream OSS scanners, fad also resolves the **Maven transitive graph** offline; so on
221
- > an air-gapped multi-module project it finds the transitive CVEs they can't.
222
-
223
- When the audited system is **offline / confidential** (typical of a regulated or air-gapped audit) it
224
- can't reach OSV / NVD / Maven Central / npm. Split the work across machines using a
225
- descriptor of **dependency coordinates and filtered version hints**, with manifest paths
226
- and registry URLs removed. Offline collection cannot distinguish private package names
227
- from public ones: exclude internal dependencies and review the descriptor, including
228
- parent/BOM coordinates, before transfer. The **detailed report is produced back on the
229
- offline machine**.
230
-
231
- The transfer relies on a property of vigievuln's caches: they are keyed by *coordinate*
232
- or *vuln id*, never by path, so they are **machine-independent**. The online step just
233
- **warms the caches**; the offline step replays the scan and gets cache hits.
186
+ Scan a confidential or disconnected project by preparing its advisory and dependency cache on an online machine. The source code and detailed report stay offline.
234
187
 
235
188
  ```bash
236
- # ── Phase 1; OFFLINE (audited machine): export the anonymized descriptor ──
237
- # Exclude private/internal packages with -e (offline we can't tell private from public).
189
+ # Offline: export coordinates, excluding internal packages; review before transfer
238
190
  vigievuln -s ./proj -e "^(client|internal)\." --export-anonymized deps.json
239
- # → deps.json: dependency coordinates and version hints. Review before transfer.
240
-
241
- # ── Phase 2; ONLINE (any machine, no source needed): warm the caches ──
242
- vigievuln --import-anonymized deps.json # scans coordinates → OSV/NVD/CVE/registry/EOL + retire signatures
243
- # + warms the CMS advisory snapshots (Drupal/PrestaShop/TYPO3 feeds,
244
- # WP checksums per core version, Wordfence when a key is set)
245
- vigievuln --export-cache fad-cache.tar.gz # bundle the warmed ~/.vigie-vuln/
246
-
247
- # ── Phase 3; OFFLINE (audited machine): full report, all local context ──
248
- vigievuln --import-cache fad-cache.tar.gz # merged into the enclave's own cache
249
- vigievuln -s ./proj --offline # re-collect locally (real paths) + cache hits
250
- # → full HTML/.doc report with manifests & structure, generated inside the enclave.
251
- # CMS advisory snapshots (Drupal/PrestaShop/TYPO3 feeds, WP checksums) fetched live by
252
- # the online phase ride the same archive and are consumed automatically — no flags.
191
+
192
+ # Online: prepare a project-specific cache from the reviewed descriptor
193
+ vigievuln cache prepare deps.json --output vigievuln-cache.tar.gz
194
+
195
+ # Offline: import the cache and generate the report locally
196
+ vigievuln --import-cache vigievuln-cache.tar.gz
197
+ vigievuln -s ./proj --offline
253
198
  ```
254
199
 
255
- Since **fad-checker 2.7.4** (included in VigieVuln 1.0.0), descriptor imports also warm Maven registry presence (unless
256
- `--no-all-libs` is set). Legacy negative presence entries are discarded automatically:
257
- older versions could confuse network errors with missing packages. Until verified
258
- online, those entries remain **unknown**, including after a cache merge. Other warmed
259
- analysis data is retained.
260
-
261
- The inherited **fad-checker 2.7.4** release also stops trusting legacy empty OSV cache entries, because an older
262
- failed request could have been stored as “no vulnerabilities”. Re-warm and export the
263
- cache with VigieVuln 1.0.0 to verify these entries; until then offline reports warn about incomplete
264
- OSV coverage. Existing cached advisory IDs remain usable. Offline KEV and binary identity
265
- lookups reuse the last available snapshot even after 24 hours, without changing its date.
266
-
267
- To reproduce the Docker integration check, run `node scripts/test-offline-docker.cjs`
268
- with dependencies installed and the `node:22-bookworm` image available locally
269
- (`FAD_DOCKER_IMAGE` overrides it). It exports a small public Maven fixture offline,
270
- warms real registries/OSV/NVD/EPSS/KEV online, then imports the archive and scans the
271
- source in a fresh container with `--network none`. It checks direct/transitive findings,
272
- all seven report formats, the expired-KEV gate and zero attempted offline network calls.
273
- No host cache is mounted. The full CVE index, EUVD and CERT-FR downloads are excluded
274
- from this focused check; logs and reports are retained in the printed temporary directory.
275
-
276
- What the descriptor (`fad-deps/1`) contains vs. drops:
277
-
278
- | Kept (needed to scan) | Dropped (environment) |
279
- | --- | --- |
280
- | ecosystem, ecosystemType | manifest paths / pom paths |
281
- | namespace, name | resolved registry URLs |
282
- | version, versions | integrity hashes |
283
- | scope, isDev | parent chains, lockfile type |
284
- | application type + core version + inventoried **public** component identities | private component identities |
285
-
286
- The online phase report is itself path-free; vendored-JavaScript (retire.js) findings are
287
- produced **offline in phase 3**, since retire needs the actual `.js` files; its signature
288
- DB is warmed online (phase 2) and carried by `--export-cache`. Full offline/cache control →
289
- [`docs/USAGE.md`](docs/USAGE.md).
200
+ Review the descriptor before sharing and the report's coverage and freshness information after scanning. An incomplete or outdated cache can limit results. [Offline workflow and cache options](docs/USAGE.md).
290
201
 
291
202
  ## Docs
292
203
 
@@ -294,27 +205,26 @@ DB is warmed online (phase 2) and carried by `--export-cache`. Full offline/cach
294
205
  - [`docs/CMS-FRAMEWORKS.md`](docs/CMS-FRAMEWORKS.md); the CMS/framework instance view: detection markers, per-product advisory lanes, coverage semantics and the air-gapped workflow.
295
206
  - [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md); internals: codecs, collection, matching, report pipeline.
296
207
  - [`docs/COMPARISON.md`](docs/COMPARISON.md); vs OSV-Scanner / Trivy / Grype / OWASP DC / Snyk, and how it stays build-free.
297
- - [`docs/BENCHMARK.md`](docs/BENCHMARK.md) — reproducible air-gapped recall benchmark vs OSV-Scanner on a public 105-module project.
208
+ - [`docs/BENCHMARK.md`](docs/BENCHMARK.md) — dated scanner comparisons on pinned projects, including warm and cold offline limitations.
298
209
  - [`docs/DATA-SOURCES.md`](docs/DATA-SOURCES.md); the public datasets vigievuln uses + their licenses.
299
- - [`CHANGELOG.md`](CHANGELOG.md) · [`CLAUDE.md`](../CLAUDE.md); release history · code-level orientation for contributors.
210
+ - [`CHANGELOG.md`](CHANGELOG.md) · [`CLAUDE.md`](CLAUDE.md); release history · code-level orientation for contributors.
300
211
 
301
212
  ## Contributing
302
213
 
303
214
  The most useful contribution to a young scanner is **telling it where it's wrong**: run it on a
304
215
  real project and file a [false positive / false negative report](https://github.com/9pings/VigieVuln/issues/new?template=false_positive.yml)
305
216
  with the coordinate and the manifest snippet that produced it. Dev setup, ground rules and the
306
- codec extension point → [`CONTRIBUTING.md`](../CONTRIBUTING.md). Vulnerabilities in vigievuln
307
- itself → [`SECURITY.md`](../SECURITY.md) (please report privately).
217
+ codec extension point → [`CONTRIBUTING.md`](CONTRIBUTING.md). Vulnerabilities in vigievuln
218
+ itself → [`SECURITY.md`](SECURITY.md) (please report privately).
308
219
 
309
- **On AI assistance:** this codebase is written with heavy use of Claude Code; [`CLAUDE.md`](../CLAUDE.md)
220
+ **On AI assistance:** this codebase is written with heavy use of Claude Code; [`CLAUDE.md`](CLAUDE.md)
310
221
  in the repo root is exactly what it looks like. The bar it's held to is the one you can check
311
- yourself: **847 tests** (`npm test`), the zero-network guarantee enforced by a tripwire test and
312
- reproducible under `unshare -rn`, and coverage numbers measured against a Snyk baseline rather
313
- than asserted. `vigievuln` itself uses **no LLM at runtime**; findings come from public
222
+ yourself: the test suite (`npm test`), the zero-network guarantee enforced by a tripwire test and
223
+ and the dated comparisons and limitations documented in [`docs/BENCHMARK.md`](docs/BENCHMARK.md). `vigievuln` itself uses **no LLM at runtime**; findings come from public
314
224
  vulnerability databases and deterministic parsers, and no report text is generated. Full
315
225
  statement, including where review actually caught a bad finding →
316
- [`AI_POLICY.md`](../AI_POLICY.md). Where the code doesn't meet that bar, that's a bug report I want.
226
+ [`AI_POLICY.md`](AI_POLICY.md). Where the code doesn't meet that bar, that's a bug report I want.
317
227
 
318
228
  ## License
319
229
 
320
- MIT; see [`LICENSE`](LICENSE).
230
+ Apache-2.0; see [`LICENSE`](LICENSE).
@@ -6,7 +6,7 @@ _fad_check_complete() {
6
6
  COMPREPLY=()
7
7
  cur="${COMP_WORDS[COMP_CWORD]}"
8
8
  prev="${COMP_WORDS[COMP_CWORD-1]}"
9
- opts="--vigievuln-proxy --proxy-cache --proxy-cache-token --src --target --exclude --verbose --no-report --no-transitive --no-all-libs --no-osv --no-nvd --no-epss --no-kev --licenses --no-retire --retire-refresh --report-output --report-html --report-doc --report-xlsx --report-sbom --report-csaf --report-json --report-sarif --fail-on --fail-on-new --baseline --no-checksums --ignore --vex --ignore-test --cve-refresh --cve-offline --snyk --transitive-depth --offline --ecosystem --no-maven --no-npm --no-yarn --no-nuget --no-composer --no-pypi --no-go --no-ruby --no-jars --no-binaries --no-certs --cert-expiry-days --retries --no-nvd-mirror --eol-support --no-eol --no-js --set-nvd-key --show-config --completion --help --version --disable --activate --report --help-all -s -t -e -h -v -d -a -r -o"
9
+ opts="--vigievuln-proxy --proxy-cache --proxy-cache-token --src --target --exclude --verbose --force-update --no-report --no-transitive --no-all-libs --no-osv --no-nvd --no-epss --no-kev --licenses --no-retire --retire-refresh --report-output --report-html --report-doc --report-xlsx --report-sbom --report-csaf --report-json --report-sarif --fail-on --fail-on-new --baseline --no-checksums --ignore --vex --ignore-test --cve-refresh --cve-offline --snyk --transitive-depth --offline --ecosystem --no-maven --no-npm --no-yarn --no-nuget --no-composer --no-pypi --no-go --no-ruby --no-jars --no-binaries --no-certs --cert-expiry-days --retries --no-nvd-mirror --eol-support --no-eol --no-js --set-nvd-key --show-config --completion --help --version --disable --activate --report --help-all -s -t -e -h -v -d -a -r -o"
10
10
  case "$prev" in
11
11
  --src|-s|--target|-t|--report-output|-o)
12
12
  COMPREPLY=( $(compgen -d -- "$cur") )
@@ -16,6 +16,7 @@ _fad_check() {
16
16
  '--allLibs[query Maven Central]'
17
17
  '-v[verbose]'
18
18
  '--verbose[verbose]'
19
+ '--force-update[revalidate online sources]'
19
20
  '--test[read-only]'
20
21
  '--report[generate CVE/EOL/obsolete report]'
21
22
  '--report-output[base dir for default-named outputs]:directory:_directories'
@@ -18,33 +18,35 @@ class AccountClientError extends Error {
18
18
  const invalidResponse = () => new AccountClientError('INVALID_RESPONSE', 'Invalid account API response.');
19
19
  const isAccount = value => value && typeof value === 'object' && !Array.isArray(value) &&
20
20
  typeof value.id === 'string' && value.id.length > 0 && typeof value.email === 'string' && value.email.length > 0;
21
- function readTerms(value) {
21
+ function readTerms(value, origin = ACCOUNT_ORIGIN) {
22
22
  if (!value || typeof value !== 'object' || Array.isArray(value) ||
23
23
  typeof value.version !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/.test(value.version) ||
24
24
  typeof value.documentUrl !== 'string' || value.documentUrl.length > 2048 ||
25
25
  /[\x00-\x20\x7f]/.test(value.documentUrl) || typeof value.accepted !== 'boolean') throw invalidResponse();
26
26
  let url;
27
- try { url = new URL(value.documentUrl, ACCOUNT_ORIGIN); } catch { throw invalidResponse(); }
28
- if (url.protocol !== 'https:' || url.origin !== ACCOUNT_ORIGIN || url.username || url.password ||
27
+ try { url = new URL(value.documentUrl, origin); } catch { throw invalidResponse(); }
28
+ if (url.origin !== origin || url.username || url.password ||
29
29
  url.pathname !== '/terms/' + value.version || url.search || url.hash ||
30
- ![url.pathname, ACCOUNT_ORIGIN + url.pathname].includes(value.documentUrl)) throw invalidResponse();
30
+ ![url.pathname, origin + url.pathname].includes(value.documentUrl)) throw invalidResponse();
31
31
  return { version: value.version, url: url.href, accepted: value.accepted };
32
32
  }
33
33
 
34
34
  /**
35
- * Account authentication for future project commands; no proxy config or keys.
36
- * Only the transport, store, clock and timeout are injectable; never the origin.
35
+ * Account authentication for the official service or an explicitly configured proxy.
36
+ * Sessions are bound to their account origin before any authenticated request.
37
37
  * login({email,password}) -> {account,expiresAt}; me() -> {account};
38
38
  * logout() -> {revoked}. logout always clears local storage, including on a
39
39
  * remote error, which is still reported (revocation is then unconfirmed).
40
40
  * The password exists only in the in-flight request, never in the store.
41
41
  */
42
- function createAccountClient({ fetcher = globalThis.fetch, now = Date.now,
42
+ function createAccountClient({ fetcher = globalThis.fetch, now = Date.now, accountOrigin = ACCOUNT_ORIGIN,
43
43
  sessionStore = createAccountSessionStore({ now }), timeoutMs = DEFAULT_TIMEOUT_MS } = {}) {
44
44
  if (typeof fetcher !== 'function' || !Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 2147483647) {
45
45
  throw new AccountClientError('INVALID_OPTIONS', 'Invalid account transport or timeout.');
46
46
  }
47
47
 
48
+ let parsedOrigin; try { parsedOrigin = new URL(accountOrigin); } catch { throw new AccountClientError('INVALID_OPTIONS', 'Invalid account origin.'); }
49
+ if (parsedOrigin.origin !== accountOrigin || !['https:', 'http:'].includes(parsedOrigin.protocol) || parsedOrigin.username || parsedOrigin.password) throw new AccountClientError('INVALID_OPTIONS', 'Invalid account origin.');
48
50
  async function request(route, method, body, token) {
49
51
  const controller = new AbortController();
50
52
  let timer;
@@ -56,7 +58,7 @@ function createAccountClient({ fetcher = globalThis.fetch, now = Date.now,
56
58
  }, timeoutMs);
57
59
  });
58
60
  const operation = async () => {
59
- response = await fetcher(ACCOUNT_ORIGIN + '/v1/accounts/' + route, {
61
+ response = await fetcher(accountOrigin + '/v1/accounts/' + route, {
60
62
  method, redirect: 'error', credentials: 'omit', cache: 'no-store',
61
63
  headers: { accept: 'application/json', ...(body !== undefined ? { 'content-type': 'application/json' } : {}),
62
64
  ...(token ? { authorization: 'Bearer ' + token } : {}) },
@@ -68,7 +70,7 @@ function createAccountClient({ fetcher = globalThis.fetch, now = Date.now,
68
70
  }
69
71
  // Also reject an injected transport that reports a redirect/followed URL.
70
72
  if (response.redirected || (response.status >= 300 && response.status < 400) ||
71
- (response.url && response.url !== ACCOUNT_ORIGIN + '/v1/accounts/' + route)) {
73
+ (response.url && response.url !== accountOrigin + '/v1/accounts/' + route)) {
72
74
  throw new AccountClientError('REDIRECT_REFUSED', 'Account API redirects are forbidden.');
73
75
  }
74
76
  if (!response.ok) {
@@ -116,7 +118,9 @@ function createAccountClient({ fetcher = globalThis.fetch, now = Date.now,
116
118
  async function currentSession() {
117
119
  const session = await sessionStore.read();
118
120
  if (!session) throw new AccountClientError('NOT_AUTHENTICATED', 'No account session. Sign in first.');
119
- return validateAccountSession(session, now());
121
+ const valid = validateAccountSession(session, now());
122
+ if ((valid.origin || ACCOUNT_ORIGIN) !== accountOrigin) throw new AccountClientError('NOT_AUTHENTICATED', 'Session belongs to another server. Sign in again.');
123
+ return valid;
120
124
  }
121
125
 
122
126
  async function login(credentials = {}) {
@@ -130,7 +134,8 @@ function createAccountClient({ fetcher = globalThis.fetch, now = Date.now,
130
134
  try { session = validateAccountSession(data, now()); }
131
135
  catch { throw invalidResponse(); }
132
136
  if (data.tokenType !== 'Bearer' || !isAccount(data.account)) throw invalidResponse();
133
- const terms = readTerms(data.account.terms);
137
+ const terms = readTerms(data.account.terms, accountOrigin);
138
+ if (accountOrigin !== ACCOUNT_ORIGIN) session.origin = accountOrigin;
134
139
  try { await sessionStore.write(session); }
135
140
  catch (error) {
136
141
  // Avoid leaving a newly issued session alive when local persistence fails.
@@ -145,7 +150,7 @@ function createAccountClient({ fetcher = globalThis.fetch, now = Date.now,
145
150
  try {
146
151
  const data = await request('me', 'GET', undefined, session.token);
147
152
  if (!isAccount(data.account)) throw invalidResponse();
148
- const terms = readTerms(data.account.terms);
153
+ const terms = readTerms(data.account.terms, accountOrigin);
149
154
  return { account: data.account, ...(terms && { terms }) };
150
155
  } catch (error) {
151
156
  if (error.code === 'UNAUTHORIZED') await sessionStore.clear();
@@ -160,7 +165,7 @@ function createAccountClient({ fetcher = globalThis.fetch, now = Date.now,
160
165
  const session = await currentSession();
161
166
  const data = await request('terms', 'POST', { termsVersion: version, accepted: true }, session.token);
162
167
  if (!isAccount(data.account)) throw invalidResponse();
163
- const terms = readTerms(data.account.terms);
168
+ const terms = readTerms(data.account.terms, accountOrigin);
164
169
  if (!terms || !terms.accepted || terms.version !== version) throw invalidResponse();
165
170
  return { terms };
166
171
  }
@@ -173,11 +178,13 @@ function createAccountClient({ fetcher = globalThis.fetch, now = Date.now,
173
178
  }
174
179
 
175
180
  async function logout() {
181
+ const existing = await sessionStore.read();
182
+ if (existing && (existing.origin || ACCOUNT_ORIGIN) !== accountOrigin) throw new AccountClientError('NOT_AUTHENTICATED', 'Session belongs to another server.');
176
183
  try {
177
184
  const stored = await sessionStore.read();
178
185
  if (!stored) return { revoked: 0 };
179
186
  let session;
180
- try { session = validateAccountSession(stored, now()); }
187
+ try { session = validateAccountSession(stored, now()); if ((session.origin || ACCOUNT_ORIGIN) !== accountOrigin) throw new AccountClientError('NOT_AUTHENTICATED', 'Session belongs to another server.'); }
181
188
  catch (error) { if (error.code === 'SESSION_EXPIRED') return { revoked: 0 }; throw error; }
182
189
  const data = await request('logout', 'POST', {}, session.token);
183
190
  if (!Number.isSafeInteger(data.revoked) || data.revoked < 0) throw invalidResponse();
@@ -15,7 +15,7 @@ class AccountSessionError extends Error {
15
15
  }
16
16
 
17
17
  // The account API uses epoch milliseconds. Never persist credentials or the
18
- // entire login response: the only permitted fields are token and expiresAt.
18
+ // entire login response: only token, expiry and an optional server origin are stored.
19
19
  function validateAccountSession(value, now = Date.now()) {
20
20
  if (!value || typeof value !== 'object' || Array.isArray(value) ||
21
21
  typeof value.token !== 'string' || !/^[A-Za-z0-9_-]{1,200}$/.test(value.token) ||
@@ -25,7 +25,11 @@ function validateAccountSession(value, now = Date.now()) {
25
25
  if (value.expiresAt <= now) {
26
26
  throw new AccountSessionError('SESSION_EXPIRED', 'Account session expired. Sign in again.');
27
27
  }
28
- return { token: value.token, expiresAt: value.expiresAt };
28
+ if (value.origin !== undefined) {
29
+ let url; try { url = new URL(value.origin); } catch { throw new AccountSessionError('INVALID_SESSION', 'Invalid account session origin.'); }
30
+ if (url.origin !== value.origin || !['https:', 'http:'].includes(url.protocol) || url.username || url.password) throw new AccountSessionError('INVALID_SESSION', 'Invalid account session origin.');
31
+ }
32
+ return { token: value.token, expiresAt: value.expiresAt, ...(value.origin && { origin: value.origin }) };
29
33
  }
30
34
 
31
35
  /**
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ const zlib = require('node:zlib');
4
+ const { DICTIONARY } = require('./compression-dictionary');
5
+
6
+ const MAX_BYTES = 16 * 1024 * 1024;
7
+
8
+ function compress(bytes) {
9
+ if (bytes.length < 1 || bytes.length > MAX_BYTES) throw new Error('advisory body exceeds SQLite cache limit');
10
+ return zlib.deflateRawSync(bytes, { level: 1, dictionary: DICTIONARY });
11
+ }
12
+
13
+ function decompress(compressed, expectedBytes) {
14
+ if (!Number.isSafeInteger(expectedBytes) || expectedBytes < 1 || expectedBytes > MAX_BYTES) {
15
+ throw new Error('invalid advisory body size');
16
+ }
17
+ const body = zlib.inflateRawSync(Buffer.from(compressed), {
18
+ dictionary: DICTIONARY,
19
+ maxOutputLength: expectedBytes,
20
+ });
21
+ if (body.length !== expectedBytes) throw new Error('advisory body size mismatch');
22
+ return body;
23
+ }
24
+
25
+ module.exports = { compress, decompress };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ // A shared alias does not prove that two advisories describe identical affected
4
+ // ranges. Without all native ranges at this reporting boundary, require agreement
5
+ // between evaluated targets rather than guessing a maximum/minimum version.
6
+ function mergeAdvisoryFixes(left, right) {
7
+ const candidates = [...new Set([...(left._fixCandidates || []), ...(right._fixCandidates || []), left.fixVersion, right.fixVersion].filter(value => typeof value === 'string' && value))];
8
+ const unknown = left.fixEvaluation === 'unknown' || right.fixEvaluation === 'unknown';
9
+ const conflict = left.fixConflict || right.fixConflict ||
10
+ (candidates.length > 1 ? 'inconsistent-advisory-targets' : candidates.length && unknown ? 'unverified-advisory' : null);
11
+ if (conflict) return { fixVersion: null, fixEvidence: undefined, branchFix: undefined, fixEvaluation: 'unknown', fixConflict: conflict, _fixCandidates: candidates };
12
+ const fixVersion = candidates[0] || null;
13
+ const result = { fixVersion, _fixCandidates: candidates };
14
+ if (fixVersion && [left, right].some(c => c.fixVersion === fixVersion && c.fixEvidence === 'explicit-unaffected-version')) result.fixEvidence = 'explicit-unaffected-version';
15
+ if (unknown) result.fixEvaluation = 'unknown';
16
+ else if (left.fixEvaluation === 'verified' || right.fixEvaluation === 'verified') result.fixEvaluation = 'verified';
17
+ if (left.branchFix || right.branchFix) result.branchFix = require('./maven-version').stricterBranchFix(left.branchFix, right.branchFix);
18
+ return result;
19
+ }
20
+
21
+ module.exports = { mergeAdvisoryFixes };