@konfirmity/reach 0.0.0-stage → 0.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.
package/LICENSE ADDED
@@ -0,0 +1,16 @@
1
+ Copyright (c) 2026 Konfirmity Pte Ltd. All rights reserved.
2
+
3
+ This software (the @konfirmity/reach package, including its bundled code and documentation) is proprietary. It is published on the npm registry for convenient installation; publication does not make it open source.
4
+
5
+ Konfirmity grants you a non-exclusive, non-transferable, revocable licence to install and run unmodified copies of the software on machines you control, to analyse code you are authorised to analyse, including with the Konfirmity reach service at https://reach.konfirmity.com under that service's terms. You may read the software's code to verify what it does and what it sends.
6
+
7
+ You may not, except as a separate written agreement with Konfirmity allows or applicable law permits despite this restriction:
8
+
9
+ - copy, modify, translate or create derivative works of the software, other than the copies needed to install and run it as permitted above;
10
+ - redistribute, sublicense, sell, rent or lend the software, or make it available to third parties as a hosted service;
11
+ - use the software, or any part of it, to build a competing product or service;
12
+ - remove or alter this notice.
13
+
14
+ This licence ends automatically if you breach it. When it ends, you must stop using the software and delete your copies.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL KONFIRMITY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR ITS USE.
package/README.md CHANGED
@@ -1,3 +1,264 @@
1
- # Temporary Holding Version
1
+ # @konfirmity/reach
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ reach tells you which known-vulnerable functions in your npm dependencies your production code actually reaches. It runs on your machine and reads your code without running it. It sends Konfirmity your installed and shipped package list, to look up advisories, and a result of verdicts only: no code, no file paths, no secrets.
4
+
5
+ **Start here: [docs/CLIENT-QUICKSTART.md](docs/CLIENT-QUICKSTART.md)**, one page of steps.
6
+
7
+ ## Get started
8
+
9
+ 1. Sign up at [reach.konfirmity.com](https://reach.konfirmity.com), name your organization and create an API key (organization admins create keys).
10
+ 2. `export REACH_API_KEY=<your key>`, or run `reach login` once to save it.
11
+ 3. Install dependencies and run your production build (for Next.js, `next build`).
12
+ 4. From the repository root, run the scan command the web app shows, which pins the CLI version:
13
+
14
+ ```sh
15
+ npx @konfirmity/reach@<version> scan
16
+ pnpm dlx @konfirmity/reach@<version> scan
17
+ bunx @konfirmity/reach@<version> scan
18
+ ```
19
+
20
+ reach drafts `reach.config.json` on the first run and asks you to confirm it, looks up advisories, asks what it could not decide, prints the exact payload and asks before uploading it. The report opens at the URL it prints.
21
+
22
+ The package needs Node.js 20 or later and bundles everything it runs, so it installs nothing else. Standalone binaries are not offered yet.
23
+
24
+ ## How it decides
25
+
26
+ reach asks four questions per advisory: does production **load** the package, does production code **reach** the vulnerable function or option, does **untrusted input** reach its arguments, and is the **condition** met? Anything reach cannot decide becomes one plain yes/no question for you. It never says "can't tell".
27
+
28
+ ## Usage
29
+
30
+ ```sh
31
+ export REACH_API_KEY=... # an organization API key from the web app, or:
32
+ reach login # asks for the key and saves it for later scans
33
+ reach scan # analyse against Konfirmity's advisories (needs network)
34
+ reach scan --advisories <file.json> # decide against a local advisory file and upload the run (with an API key)
35
+ reach scan --advisories <file.json> --offline # the same, sending nothing even with an API key
36
+ reach init [--dir .] [--write] # draft reach.config.json
37
+ reach --advisories <file.json> --dry-run # print the result that would be sent
38
+ reach --advisories <file.json> --out reach-result.json
39
+ reach --advisories <file.json> --questions # list the open questions
40
+ reach analyze --facts-out facts.json # analyse only, and save the facts
41
+ reach decide --facts facts.json --dry-run # decide from saved facts alone
42
+ ```
43
+
44
+ All flags: `[--dir .] [--profile reach.config.json] [--advisories <file.json>] [--api-url <url>] [--project-name <name>] [--tier runtime|build] [--dry-run] [--offline] [--out <file>] [--with-locations] [--vex out.json] [--questions] [--facts-out <file>] [--advisories-out <file>] [--facts <file>] [--yes] [--ci]`. `reach --help` prints them.
45
+
46
+ Run in a terminal (without `--dry-run`, `--questions`, `--yes` or `--ci`), reach asks each open question after the analysis: answer `yes`, `no` or `unsure`, press Enter to skip one, or `q` to stop. Each answer is saved to `reach.config.json` as you give it, with the question's `inputs` digest, `answeredBy` (your `git config user.name`, else your login name) and `answeredAt` (today's date), and the file is edited in place so its comments and layout survive. An answer can open a follow-up question (an option you confirm is set leads to where its input comes from), which is asked in the same run; the result then reflects every answer. Without a terminal, reach asks nothing and behaves exactly as with `--yes`.
47
+
48
+ | Flag | Meaning |
49
+ |------|---------|
50
+ | `--profile <file>` | The repository profile. Defaults to `<dir>/reach.config.json`. reach refuses to run without one. |
51
+ | `--tier runtime\|build` | `runtime` (the default) checks what production loads. `build` also checks what your build tools load, and reports those results separately in `buildResults`. |
52
+ | `--dry-run` | Print exactly the payload that would be sent, then stop. |
53
+ | `--offline` | With `reach scan --advisories <file>`: send nothing, even when an API key is available. `reach scan --offline` without `--advisories` exits 2. |
54
+ | `--out <file>` | Save that same payload to a file. |
55
+ | `--with-locations` | Add a relative file path and line to each result. Without it, no path appears. |
56
+ | `--vex <file>` | Write OpenVEX statements for the runtime results (see below). |
57
+ | `--questions` | Print the open questions as a checklist, each with the line to paste into `answers`. |
58
+ | `--yes` | Ask nothing; use only the answers already saved (in `reach.config.json` and, for `reach scan`, in the web app). With `reach scan`, upload without asking. |
59
+ | `--ci` | As `--yes` for questions, and `reach scan` records the upload as a CI run. `reach scan --ci` uploads only together with `--yes` (or prints only, with `--dry-run`), and then exits 3 when the run has a newly exploitable advisory. |
60
+ | `--facts-out <file>` | Save the analysis facts behind the run (see "Recorded facts"). With `reach analyze`, reach stops after saving them. |
61
+ | `--advisories <file>` | Decide against this advisory file instead of looking advisories up. With `reach scan` and an API key, the run is uploaded with the file's advisories (see "What leaves the machine"). Other commands default to `<dir>/reach-advisories.json`. |
62
+ | `--advisories-out <file>` | Save the advisories the run was decided against: with `reach scan`, those Konfirmity served. |
63
+ | `--facts <file>` | With `reach decide`: the facts to decide from. Answers the recorded run applied (web app answers included) apply where `reach.config.json` has none. |
64
+ | `--api-url <url>` | The Konfirmity server. Defaults to `REACH_API_URL`, else the URL `reach login` saved, else the production server. `http://localhost:3000` for a local web app; plain `http` is refused for any other host. |
65
+ | `--project-name <name>` | With the first `reach scan`: the project to create or select. Defaults to the `package.json` name, else the directory name. |
66
+
67
+ ### API key and project
68
+
69
+ `reach scan` authenticates with an organization API key created in the web app. It reads the key from `REACH_API_KEY`, else from `reach login`, which asks for the key without echoing it (or reads it from standard input), checks it with the server, and saves it to `$XDG_CONFIG_HOME/konfirmity-reach/credentials.json` (`~/.config/...` by default, `%APPDATA%\konfirmity-reach` on Windows, `REACH_CONFIG_DIR` overrides the directory), readable only by you. The key is never a flag, so it stays out of shell history and CI logs.
70
+
71
+ After ships has worked out what production loads, `reach scan` looks up advisories for every installed version in the lockfile and every shipped copy (`POST /api/v1/advisories`), so a vendored, bundled or nested copy the lockfile does not list is looked up too. A copy whose version is not SemVer (`unknown`, `vendored:...`) is looked up by name, which returns every advisory for the package; such a copy is never `not_shipped` for them. The analysis then runs against the advisories the server returned, and the run records the feed version they came from. A lookup the server cannot answer fails the scan (exit 1) rather than deciding against no advisories. With `--advisories <file>`, scan decides against that file instead and never looks advisories up. When an API key is available it still creates or selects the project, reads the web app's answers and uploads the run with the file's advisories, which the report labels as supplied by the CLI, not served by Konfirmity; without a key, or with `--offline`, `--dry-run` or `--questions`, it sends nothing.
72
+
73
+ The first `reach scan` in a repository without `reach.config.json` drafts one and asks you to confirm each drafted entry, as `reach init` does in a terminal. It then creates the project in your organization (or selects the one with that name) and saves its id in `reach.config.json` as `project`; commit it so every run, local or CI, uploads to the same project.
74
+
75
+ ### Answers and upload
76
+
77
+ Before deciding, `reach scan` fetches the answers given in the web app for the project (`GET /api/v1/projects/:id/answers`) and uses them alongside the answers in `reach.config.json`, without writing them to the file. When both hold an answer to the same question, the file's answer is used. An answer whose inputs digest no longer matches the question is not applied and the question is asked again, as for answers in the file. Each web app answer comes with the id of its entry in the project's answer history; the upload names the entry of every web app answer the run applied, so the report credits the member who gave that answer even if someone changes it while the scan runs. An answer taken from `reach.config.json` is never named, so the report credits the file.
78
+
79
+ After deciding, reach checks the payload with the same upload checks the server runs. In a terminal, it prints the exact payload and asks before sending it; `--yes` sends without asking, and without a terminal and without `--yes` nothing is sent. The upload (`POST /api/v1/runs`) carries the source (`local`, or `ci` with `--ci`), the id of the advisory lookup the run was decided against, the payload, including the upgrade groups, and the answer history entry id of each web app answer the run applied. The server stores its own copy of the advisories it served under that id, with their feed version and the package list looked up, so a run never records advisories the client sent back. A run decided against `--advisories <file>` carries the file's advisories instead of a lookup id, and the server stores them as supplied by the CLI, with no feed version or package list. reach then prints the report URL and the advisories that are `exploitable` now but were not in the project's previous run.
80
+
81
+ Exit codes:
82
+
83
+ | Code | Meaning |
84
+ |------|---------|
85
+ | `0` | Done, whatever the verdicts are (including an upload you declined) |
86
+ | `1` | The analysis failed, the server could not be reached or could not answer, or the result failed the upload checks (locally or on the server) |
87
+ | `2` | Bad input: flags, profile, advisory file, a missing or refused API key, a `project` the key's organization does not have, `scan --ci` without `--yes` |
88
+ | `3` | `reach scan --ci --yes` only: the run has an `exploitable` advisory (by id and package, at either tier) that the project's previous run did not; on a project's first run, any `exploitable` advisory |
89
+ | `130` | Interrupted (Ctrl-C) |
90
+
91
+ ### CI
92
+
93
+ ```sh
94
+ REACH_API_KEY=${{ secrets.REACH_API_KEY }} npx @konfirmity/reach@<version> scan --ci --yes
95
+ ```
96
+
97
+ (`pnpm dlx` or `bunx` work the same way.) Run it after the production build, with `reach.config.json` (including `project`) committed. It asks nothing, uses the answers saved in the file and in the web app, uploads the run as a CI run and fails the job with exit code 3 when an advisory became exploitable since the previous run. Questions still open stay open; answer them in the web app and the next run applies them.
98
+
99
+ ## Verdicts
100
+
101
+ | Verdict | Meaning | Evidence kinds |
102
+ |---------|---------|----------------|
103
+ | `not_shipped` | Production loads no copy of the package at an affected version. | `build-trace` |
104
+ | `shipped_not_reachable` | An affected copy is loaded, the advisory's entry points are complete (`entryPointsComplete: true`), and no loaded code calls an affected symbol, or every call leaves the vulnerable option unset. | `build-trace`, `dependency-chain`, `call-site` |
105
+ | `no_known_path` | The same finding as `shipped_not_reachable`, but the advisory's entry points are incomplete, so it is deprioritised, not proven safe. It carries no question. | `build-trace`, `dependency-chain`, `call-site` |
106
+ | `reachable_not_exploitable` | A call meets the condition, but only trusted input reaches it. | `call-site`, `source-trace` |
107
+ | `exploitable` | A call meets the condition and untrusted input reaches it. | `call-site`, `source-trace` |
108
+ | `assumed` | reach could not decide. It always carries a `question` and the customer step that answers it. | as gathered so far |
109
+
110
+ Rules behind them:
111
+
112
+ - A call site counts only if its file ships: one of production's own files, or code inside a dependency that production loads. Tests, examples and imports that are never called do not count.
113
+ - `precision: "package"` advisories treat "loaded" as "reachable", so the open question is whether untrusted input reaches the package.
114
+ - For a `withOption` symbol, the options argument is `optionArg` when the advisory sets it, else the last argument. A missing argument, a literal, or an object literal without the key leaves the option unset. A spread or a value reach cannot read raises a `config-question`.
115
+ - An argument whose source was not traced counts as unknown, never as trusted.
116
+ - A call that matches any symbol the advisory lists is decided as usual, never `no_known_path`.
117
+ - Each symbol has a tier (`curated`, `reviewed` or `candidate`; missing means `curated`). A result decided from call sites records `matchTier`, the highest tier among the advisory's matched symbols, and within one verdict the results are ordered reviewed first, candidate-only last. Tiers never remove a match.
118
+ - In the `build` tier, a result that would be reachable asks whether build tools count as production (`entry-confirmation`), unless the profile sets `includeBuildTools`.
119
+ - A loaded copy whose version semver cannot read (`name@vendored:<host>@<version>` for a copy bundled inside another package without its own version, or `name@unknown`) is never compared as "not affected". Its calls count as affected calls, and a result that would otherwise be `not_shipped`, `shipped_not_reachable` or `no_known_path` becomes `assumed` with a `build-output` question asking whether that copy is at an affected version.
120
+
121
+ ### Dev is never evidence of safety
122
+
123
+ A package declared only in `devDependencies`, or an advisory marked `scope: "dev"`, is never `not_shipped` for that reason. reach ignores the advisory's `scope` field, and a copy ships whenever production loads it:
124
+
125
+ - a dev-declared copy in the production trace is shipped, and its result's `reason` names the leak (`in-production-trace`);
126
+ - a production start command that runs a dev server (`next dev`, `vite`, `nodemon`, `ts-node`, `tsx watch`, `webpack serve`) or a TypeScript loader (`node --import tsx`) ships everything that tool loads (`dev-server-in-production`, `runtime-loader-in-production`). Start commands are read from `package.json` `start`/`serve`, Dockerfile `CMD`/`ENTRYPOINT`, Procfile, compose files, PM2 configs and `vercel.json`/`netlify.toml`/`fly.toml`, following package scripts and shell scripts;
127
+ - when a server, Next.js app or worker has no start command anywhere, every package installed at an affected version that the trace does not load becomes `assumed` with the `config-question` "What command runs in production?". Save the exact command as that question's answer; reach reads it as a start command on the next run, and the payload records only that an answer was given. Run in a terminal, reach offers a numbered pick-list for this question (the repository's package scripts other than test, lint, build and similar tooling, plus `node <file>` for each server or worker entry and `next start` for each Next.js entry); pick a number or type the command. The command is saved only in `reach.config.json` and never leaves the machine;
128
+ - when production runs a dev server or loader reach cannot trace, the same packages become `assumed` with a `runtime-recording` question.
129
+
130
+ The customer steps behind `assumed`:
131
+
132
+ | Step | Example question |
133
+ |------|------------------|
134
+ | `config-question` | Do your calls to `axios.request` set the `maxRedirects` option? |
135
+ | `source-confirmation` | Can user input (request bodies, query strings, headers, webhooks, queue messages, uploaded files) reach the arguments of `lodash.template`? |
136
+ | `entry-confirmation` | Your build tools load `esbuild`. Do build tools count as production for this repository? |
137
+ | `build-output` | reach could not trace every file production loads. Run your production build and re-run reach, or answer whether production loads the package. |
138
+
139
+ ### Coverage: never safe about code reach could not read
140
+
141
+ reach classifies every in-scope file (your own files, every file a shipped package loads, Svelte/Astro/Marko files under your entry workspaces, a shipped package's native files and platform packages, Next.js client chunks) as read or not read. A file is not read for one of these reasons:
142
+
143
+ | Reason | File |
144
+ |--------|------|
145
+ | `unsupported-language` | `.svelte`, `.astro`, `.marko`, `.riot`, `.mdx`, `.coffee`, `.imba`, `.civet` |
146
+ | `vue-template` | a `.vue` file whose `<template>` holds expressions; reach reads only its `<script>` blocks |
147
+ | `parse-error` | a file that failed to parse, or a `.vue` file that failed to compile |
148
+ | `minified-unanalysed` | a loaded `.js` file that looks minified (long lines) or exceeds 2 MB |
149
+ | `native-binary` | `.node`, `.wasm`, an executable `bin`, or any executable in a package's per-platform `optionalDependencies` package (esbuild, swc) |
150
+ | `source-map-missing` | a Next.js client chunk with no `.map` beside it |
151
+
152
+ A result that would be `not_shipped`, `shipped_not_reachable` or `no_known_path` becomes `assumed` when any of these holds:
153
+
154
+ - a not-read file of yours or of a shipped package mentions the package (a quoted import specifier, or its name as a word). A `vue-template` file counts only against `shipped_not_reachable` and `no_known_path`, because ships follows a Vue file's imports, and only its `<template>` counts, because reach read its `<script>` blocks: the template must name the package or, when the script names it, a name the script imports from it or one of the advisory's symbols;
155
+ - the package's loaded copy, its platform packages, or a package on its dependency chain holds `native-binary` or `minified-unanalysed` files, and no read code calls the advisory's symbols;
156
+ - the advisory's `coverage` puts the fix outside the package source or records skipped bundled files, or its `validationNote` says the fix sits in native or minified code, and an affected copy is loaded.
157
+
158
+ `not_shipped` stands when nothing in production loads the package or its native companions and no unread file mentions it. The downgraded result's `reason` names the kind and count of unread files (never their paths), its question asks for a `runtime-recording` (native or minified code), a `source-confirmation` (templates, other languages, parse errors) or a `build-output` (client chunks without source maps), and it carries `needsReview: true`, marking exactly those files as the residue to review for the advisory's symbols. With `--with-locations` it also lists the unread files as `unreadFiles`. Answer `no` to keep the safe verdict, or `yes` to count the package as reachable. The summary and the payload's `summary.coverage` give, per tier, the files read, the files not read by reason, and the number of results downgraded. The known gaps and their phase-2 plans are in the repository's `docs/GAPS.md`.
159
+
160
+ ## The customer loop
161
+
162
+ 1. Run `reach init`, check the draft with the team, and commit `reach.config.json`.
163
+ 2. Run your production build (for Next.js, `next build`), so reach can read what ships.
164
+ 3. Run `reach scan`: it looks up advisories, asks the open questions, prints the exact payload and asks before uploading it. The report opens at the URL it prints. Offline, run `reach scan --advisories <file> --offline` (or `reach --advisories <file> --dry-run` to print the payload), which sends nothing.
165
+ 4. Answer the open questions in the web app, or run `reach scan` in a terminal and answer them as it asks, or run `reach --questions` and paste each line it prints into the profile's `answers`, `{ "answer": "yes" | "no", "inputs": "<digest>" }`, keeping one of the two values. `unsure` is kept as an answer but leaves the question open.
166
+ 5. Re-run. A question id is a hash of the advisory id, the step and a stable subject (the package, or the option name for a config question), so it survives changes to the advisory's symbol list. Each answer also records `inputs`, a digest of the advisory facts the question showed (symbols, options, completeness, coverage facts, affected versions where relevant). When those facts change, the answer is not applied and the question is asked again, prefixed "Re-asked" with the old answer. An answer without `inputs` is treated the same way, except for the repository questions (start command, dev server).
167
+
168
+ ## What leaves the machine
169
+
170
+ Only `reach scan` and `reach login` send anything, always to the API URL with your API key. `reach login` checks the key (`GET /api/v1/whoami`, no body). Every other command (`reach` without a command, `init`, `analyze`, `decide`) sends nothing.
171
+
172
+ | Command | Sends |
173
+ |---|---|
174
+ | `reach scan` | Reads the project's answers; sends the **installed and shipped package list** (each package name with its lockfile or shipped version, or the name alone when the version is not SemVer) to look up advisories; once you confirm (or with `--yes`), uploads the run: the project id, the source (`local` or `ci`), the id of the advisory lookup, the result payload, and for each web app answer the run applied, its question id and the server's id for that answer. |
175
+ | `reach scan --advisories <file>` with an API key | Reads the project's answers; once you confirm (or with `--yes`), uploads the run: the project id, the source, the result payload, the advisories from the file, as validated (advisories for other ecosystems left out), and the ids of the web app answers the run applied, as above. It never sends the package list and never looks advisories up. |
176
+ | `reach scan --advisories <file>` without an API key, or with `--offline` | Nothing. |
177
+ | `reach scan` with `--dry-run` or `--questions` | No upload; without `--advisories` it still reads the answers and looks advisories up, with `--advisories <file>` it sends nothing. |
178
+
179
+ The first scan in a repository without a `project` in `reach.config.json` also sends the project name. Without a terminal and without `--yes`, no run is uploaded.
180
+
181
+ The result payload holds advisory ids and aliases, package names and affected installed versions, verdicts, evidence kinds and counts, question ids, texts and steps, counts of files and packages checked, coverage counts by reason, the `needsReview` flag, each result's `matchTier`, `restsOnAnswer` (a question id) and `appliedAnswers` (the ids of the questions whose saved answers its verdict applied), each open question's `inputs` digest, the questions whose answers the run applied (`appliedQuestions`: id, text, step, digest and advisory ids), and your answers, reduced to `yes`, `no`, `unsure`, `unrecognised`, `given` (the start command, never its text) or `stale` (not applied because its inputs changed), and the upgrade groups (package names, versions, advisory ids, the names of workspace packages and dependencies involved, and the package-manager step). No request ever carries code, argument text, file contents, paths (unless `--with-locations`), start commands, environment values or secrets. The payload is built from an allow-list of fields and checked with the server's upload checks before it is sent; a result that fails them is not sent. Tests plant a fake secret, an environment value and absolute paths in every engine output and prove none of them reaches the payload, the summary, the advisory lookup or the upload, including an upload decided against an advisory file, which carries only the payload, the file's advisories and the answer ids.
182
+
183
+ ## Recorded facts
184
+
185
+ reach works in two halves: an analyzer reads your repository and reports facts (what production loads, call sites, where their arguments come from, which files it could not read), and the verdict layer decides from those facts alone. `reach analyze --facts-out facts.json` runs only the first half and saves the facts; `reach decide --facts facts.json` runs only the second, without reading the repository, and prints exactly what the original run would have. Decide refuses facts recorded for another profile, start command or advisory file; saved answers may differ, because they change verdicts, not facts. To decide an online scan again offline, save its advisories too: `reach scan --facts-out facts.json --advisories-out advisories.json`, then `reach decide --facts facts.json --advisories advisories.json` prints the identical result, using the answers the scan applied (the web app's included) unless `reach.config.json` answers the same question.
186
+
187
+ The facts file holds absolute paths on your machine. It is for debugging and comparison, never for sending: the payload is the only thing that leaves.
188
+
189
+ ## Fix plan: upgrade groups
190
+
191
+ When reach can read a lockfile, the payload carries `upgradeGroups`: one entry per action that clears advisories whose result is `exploitable`, `reachable_not_exploitable`, `assumed` or `no_known_path`. Each group has `action`, `package`, `from` (installed versions), `to` (the lowest version that clears every advisory in the group, from the advisories' fixed versions), `advisoryIds`, and `fix`, the step in the project's package manager (npm, pnpm, yarn classic, yarn berry or bun, from the lockfile):
192
+
193
+ | `action` | When | `fix`, for pnpm |
194
+ |---|---|---|
195
+ | `refresh` | Every range that pulls the affected copy already allows the fixed version, so the lockfile only has to move | `pnpm update -r minimist` |
196
+ | `upgrade` | A package.json (or a pnpm catalog) declares a range that keeps the fixed version out | `pnpm --filter web add lodash@^4.17.21`, or a pnpm catalog edit |
197
+ | `override` | A dependency's declared range keeps the fix out (named in `heldBy` as `name@version`), or no declared range explains the copy at all | set the version under `pnpm.overrides`, then `pnpm install` |
198
+
199
+ Copies in different major lines are separate groups. Advisories with no fixed version are left out. Groups are computed offline from the lockfile and the installed packages, so reach cannot name the release of a parent that would pull the fix; an `override` is the fix that needs no registry lookup. The summary lists the steps under "fix plan".
200
+
201
+ ## VEX
202
+
203
+ `--vex out.json` writes an OpenVEX v0.2.0 document for the runtime results. The product is your root `package.json` name and version, and each package appears as a `pkg:npm/...` subcomponent. Build-tool results are left out, because they describe the build, not what ships.
204
+
205
+ | Verdict | OpenVEX status | Justification |
206
+ |---------|----------------|---------------|
207
+ | `not_shipped` | `not_affected` | `vulnerable_code_not_present` |
208
+ | `shipped_not_reachable` | `not_affected` | `vulnerable_code_not_in_execute_path` |
209
+ | `exploitable` | `affected` | (with an action statement) |
210
+ | `reachable_not_exploitable`, `no_known_path`, `assumed` | `under_investigation` | |
211
+
212
+ A `not_shipped` or `shipped_not_reachable` result reached through a customer answer (build tools, build output, an unreadable version, options, a dev server or a coverage question answered `no`) carries `restsOnAnswer` with the question id. Its statement keeps the justification and adds an `impact_statement` naming the question, who answered it and when (from `answeredBy` and `answeredAt` in the saved answer, or "not recorded"), so it is never presented as proven. Every result, whatever its verdict, lists the questions whose answers it applied in `appliedAnswers`, so an `exploitable` reached through a "yes" names that answer too (payload `schemaVersion` 5).
213
+
214
+ ## The profile: `reach.config.json`
215
+
216
+ Comments and trailing commas are allowed. Unknown fields are rejected, so typos surface.
217
+
218
+ ```jsonc
219
+ {
220
+ "version": 1,
221
+ "workspaces": ["apps/web", "apps/api"],
222
+ "entries": [
223
+ // files are relative to the workspace; "." is the repository root
224
+ { "workspace": "apps/web", "files": [], "kind": "next-app" }, // [] = every route file
225
+ { "workspace": "apps/api", "files": ["src/server.ts"], "kind": "server" }
226
+ ],
227
+ "buildOutput": { "nextDirs": ["apps/web/.next"] },
228
+ "untrustedSources": [
229
+ { "module": "apps/web/app/**/route.ts", "export": "POST", "param": 0, "note": "route handler requests" },
230
+ { "module": "express", "param": 0, "note": "req in every Express route" }
231
+ ],
232
+ "ignore": ["**/*.test.*", "**/examples/**"],
233
+ "includeBuildTools": false,
234
+ "answers": { "q-42737b723c96": { "answer": "no", "inputs": "4a5cb67bf8d31aa1" } }
235
+ }
236
+ ```
237
+
238
+ | Field | Meaning |
239
+ |-------|---------|
240
+ | `version` | Always `1`. |
241
+ | `workspaces` | Workspace directories in scope. |
242
+ | `entries` | Production entry points. `kind` is one of `server`, `next-app`, `cli`, `worker`, `lambda`, `library`. At least one is required. `files` are paths or globs relative to the workspace, or an `.html` page (its `<script src>` files are traced as browser code). An empty `files` list means "the workspace's usual entries": for `next-app`, every App Router and Pages Router route file (`page`, `layout`, `route`, ... under `app/`, `src/app/`, `pages/`, `src/pages/`) plus `instrumentation`, `middleware` and `proxy`; for any other kind, the workspace `package.json` `bin`, `main` and every `exports` target, with `dist/` mapped back to source when unbuilt. |
243
+ | `buildOutput` | Where your build writes its trace: `nextDirs` (`.next` directories) and `dist` directories. |
244
+ | `untrustedSources` | Inputs you confirm are attacker-controlled. See the matching rules below. |
245
+ | `ignore` | Globs that are never production. One exception: a test-like file (`__tests__/`, `__mocks__/`, `test/`, `fixtures/`, `examples/`, `stories/`, `*.test.*`, `*.spec.*`, `*.stories.*`) that production code imports is still followed, because ignoring it could hide code that ships; its call sites count, and ships records a `test-code-in-production` note. Any other ignored file is not followed even when imported, and ships records an `imports an ignored file` note. |
246
+ | `includeBuildTools` | Whether build tools count as production. Leave it out to be asked per advisory. |
247
+ | `project` | The Konfirmity project id, written by the first `reach scan`. Delete it to create or select the project by name again. |
248
+ | `answers` | Question id to `{ "answer": "yes" \| "no" \| "unsure", "inputs": "<digest>" }`, as `--questions` prints it and as reach saves it when it asks in a terminal; `"answeredBy"` and `"answeredAt"` record who answered and when. `unsure` never changes a verdict. The start-command and dev-server questions also take a bare string. |
249
+
250
+ ### `untrustedSources` matching
251
+
252
+ Each entry names a parameter or a value the engine treats as attacker-controlled when it traces a vulnerable call's arguments backwards. There are three forms:
253
+
254
+ | Form | Example | Matches |
255
+ |------|---------|---------|
256
+ | Package callback parameter | `{ "module": "express", "param": 0 }` | Parameter `param` (zero-based) of a function passed **directly** as an argument to a call on a value from `module`. `export` then `member` must lead the value's property path, calls skipped: `express().post(...)` has the path `post`, `express.Router().get(...)` has `Router.get`, and a typed instance method such as socket.io's `socket.on(...)` has `on`. So `{ "module": "socket.io", "member": "on", "param": 0 }` is the first argument of every `socket.on` handler. |
257
+ | Package value | `{ "module": "next/headers", "export": "headers" }` | A value read from `module` whose path starts with `export`, then `member`, such as `headers()` or `headers().get("x")`. |
258
+ | Your own files | `{ "module": "app/**/route.ts", "export": "POST", "param": 0 }` | Parameter `param` of the function exported as `export` (`default` for a default export) from a file matching the glob, relative to the repository root. `export` and `param` are required. A module counts as your own files when it starts with `./`, contains `*`, or ends in a script or `.vue` extension. |
259
+
260
+ Type names never match: `{ "module": "express", "export": "Request" }` names a type, not a value, so it marks nothing. A function in an object literal (`useMutation({ mutationFn: (file) => ... })`) is not passed directly to a call, so name the exported function it hands the data to instead.
261
+
262
+ `reach init` drafts the profile from the root `workspaces` field (or `pnpm-workspace.yaml` and the lockfile), each package's `main`, `exports` (skipping type files) and `bin`, the files production start commands run (`package.json` `start`/`serve`, Dockerfile `CMD`/`ENTRYPOINT`, `Procfile`, compose and pm2 files, following `npm run` and shell scripts) when no entry names them yet, Next.js `app/` and `pages/` directories (also under `src/`), and any `.next` directories it finds. It proposes the request parameter of each App Router route handler method, Pages Router API route and `middleware`/`proxy` file as untrusted sources for a Next.js workspace, and `{ "module": "express", "param": 0 }` when Express is a dependency. It is a draft: confirm every entry with the team before the first run. An entry taken from a start command carries a `draft` field naming the command; reach refuses the profile until each such entry is confirmed and its `draft` field deleted, or the entry removed. Run in a terminal (without `--yes` or `--ci`), `reach init` asks about each drafted entry instead: `yes` keeps it and removes its `draft` field, `no` removes the entry, Enter leaves the draft; without `--write` it then asks whether to save the profile.
263
+
264
+ When `reach.config.json` already exists, `reach init` also moves its saved answers to the current question ids, once. Source questions used to be identified by their symbol list and config questions by all their option names at once; an answer whose old id belongs to exactly one current question moves to it without an inputs digest, so reach asks it once more, showing the old answer. An answer to several options at once, or one that matches no question for the advisories, is dropped, and init prints a note for each. This needs the advisory file the answers were given against (`--advisories`, default `reach-advisories.json`); without it the answers are left untouched. The file is edited in place, keeping its comments.