@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 +16 -0
- package/README.md +263 -2
- package/dist/reach.js +11657 -0
- package/docs/CLIENT-QUICKSTART.md +97 -0
- package/package.json +45 -4
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# reach: quickstart
|
|
2
|
+
|
|
3
|
+
reach tells you which known vulnerabilities in your npm dependencies your production code can actually reach, so you fix the few that matter instead of all of them. It runs on your machine and reads your code without running it. It sends Konfirmity the list of packages you install and ship (names and versions, to look up their advisories) and, once you confirm, a result of verdicts: no code, no file paths, no secrets. The report opens in the web app at https://reach.konfirmity.com.
|
|
4
|
+
|
|
5
|
+
## What you need
|
|
6
|
+
|
|
7
|
+
- The repository, checked out, on a machine that can build it, with its lockfile.
|
|
8
|
+
- Node.js 20 or later, and npm, pnpm or bun to fetch reach.
|
|
9
|
+
- An account at https://reach.konfirmity.com.
|
|
10
|
+
- Network access to `reach.konfirmity.com` from wherever reach runs, CI included.
|
|
11
|
+
- About 15 minutes for the first run, most of it the steps you already know (install, build).
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. **Sign up** at https://reach.konfirmity.com and name your organization. Everything you upload belongs to it.
|
|
16
|
+
2. **Create an API key.** Onboarding (or Keys, later) shows the organization's keys to its admins; a member asks an admin for one. The key is shown once: store it in your password manager or your CI's secrets.
|
|
17
|
+
3. **Give reach the key**, either for this shell:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
export REACH_API_KEY=<your key>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or once per machine, with `reach login`, which asks for the key without echoing it, checks it with the server and saves it, readable only by you (`npx @konfirmity/reach@<version> login`). reach never takes the key as a flag, so it stays out of shell history and CI logs.
|
|
24
|
+
4. **Install dependencies and run your production build**, from the repository root, the way you normally do (`npm ci` then `npm run build`, `next build`, `vite build`, ...). reach reads `node_modules`, your lockfile and the build output to see what ships. Without a build, reach still works but asks more questions.
|
|
25
|
+
5. **Scan**, from the repository root, with the command the web app shows. It pins the CLI version: an unpinned `npx` of a security tool would install whatever is published at that moment.
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npx @konfirmity/reach@<version> scan
|
|
29
|
+
pnpm dlx @konfirmity/reach@<version> scan
|
|
30
|
+
bunx @konfirmity/reach@<version> scan
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Pick the line for your package manager. Everything reach needs is in the package; it installs nothing else. On the first run in a repository, reach:
|
|
34
|
+
- drafts `reach.config.json` and asks you to confirm each entry point it found (your server, your Next.js app, workers, lambdas). Correct the file with someone who knows the app: `entries` are the files production starts from, `untrustedSources` where outside input arrives (HTTP requests, webhooks, queue messages, uploaded files), and `ignore` folders that never run in production. An entry carrying a `"draft"` field must be confirmed (delete the field) or removed before reach runs;
|
|
35
|
+
- creates the project in your organization, named after your `package.json` (`--project-name <name>` to choose), and saves its id in `reach.config.json` as `project`;
|
|
36
|
+
- looks up advisories for your installed and shipped packages, analyses, and asks each question it could not decide (`yes`, `no` or `unsure`; Enter skips one, `q` stops), saving each answer to `reach.config.json` with your name and the date;
|
|
37
|
+
- prints the exact payload it would upload and asks before sending it.
|
|
38
|
+
6. **Open the report** at the URL reach prints. Commit `reach.config.json`, including `project`, so every run, local or CI, goes to the same project.
|
|
39
|
+
7. **Answer the open questions** in the web app (Questions), and run the scan again: answers turn questions into verdicts, and a re-run is what applies them, because the evidence behind them exists only on your machine. If the advisory data behind an answer changes, reach asks the question again, starting "Re-asked".
|
|
40
|
+
|
|
41
|
+
## In CI
|
|
42
|
+
|
|
43
|
+
Run the same pinned command after the production build, with `reach.config.json` (including `project`) committed and the key in a secret:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
REACH_API_KEY=${{ secrets.REACH_API_KEY }} npx @konfirmity/reach@<version> scan --ci --yes
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`--ci --yes` asks nothing, uses the answers saved in `reach.config.json` and in the web app, uploads without the confirmation prompt and records the run as a CI run. `scan --ci` without `--yes` exits 2 rather than uploading silently. Questions still open stay open; answer them in the web app and the next run applies them.
|
|
50
|
+
|
|
51
|
+
| Exit code | Meaning |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `0` | Done, whatever the verdicts are |
|
|
54
|
+
| `1` | The analysis failed, the server could not be reached or could not answer, or the result failed the upload checks |
|
|
55
|
+
| `2` | Bad input: flags, `reach.config.json`, an advisory file, a missing or refused API key, a `project` your organization does not have, `scan --ci` without `--yes` |
|
|
56
|
+
| `3` | The run has an `exploitable` advisory that the project's previous run did not (on a project's first run, any `exploitable` advisory). Fail the job on it. |
|
|
57
|
+
| `130` | Interrupted |
|
|
58
|
+
|
|
59
|
+
## Without the network, or with your own advisories
|
|
60
|
+
|
|
61
|
+
A scan needs `reach.konfirmity.com`: it looks advisories up there, and fails (exit 1) rather than decide against nothing when it cannot. To decide against an advisory file you already have instead:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
npx @konfirmity/reach@<version> scan --advisories advisories.json --offline # sends nothing at all
|
|
65
|
+
npx @konfirmity/reach@<version> scan --advisories advisories.json # with a key: uploads the run and the file's advisories
|
|
66
|
+
npx @konfirmity/reach@<version> --advisories advisories.json --dry-run # prints the result that would be sent, sends nothing
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`--advisories` never sends your package list and never looks anything up. With an API key and without `--offline`, the run and the file's advisories are uploaded after you confirm, and the report labels the advisories as supplied by the CLI, not served by Konfirmity.
|
|
70
|
+
|
|
71
|
+
## What leaves your machine, and what never does
|
|
72
|
+
|
|
73
|
+
Only `reach scan` and `reach login` send anything, always to `https://reach.konfirmity.com` (or the URL in `REACH_API_URL` / `--api-url`) with your API key. Every other command sends nothing.
|
|
74
|
+
|
|
75
|
+
- **`reach login`** checks the key; the request has no body.
|
|
76
|
+
- **`reach scan`** reads the project's answers from the web app, then sends the **installed and shipped package list**: each package name with the version your lockfile installs or your build ships, or the name alone when the version is not a plain version number. Konfirmity looks those up in its advisory data. The first scan also sends the project name.
|
|
77
|
+
- **The upload**, only after you confirm (or with `--yes`): the project id, whether it is a local or CI run, the id of the advisory lookup the run used, the result payload, and for each answer from the web app that the run applied, the question id and the server's id for that answer. A scan with `--advisories <file>` uploads the file's advisories instead of a lookup id, and never sends the package list.
|
|
78
|
+
|
|
79
|
+
The result payload holds: advisory ids and aliases, package names and the affected versions you have installed, one verdict per advisory, the *kinds* and *counts* of evidence behind it, the open questions (id, text, step), counts of files and packages checked and of files reach could not read (by reason), your answers reduced to `yes`, `no` or `unsure` (for "What command runs in production?", only that an answer was given), and a fix plan: which package to upgrade, refresh or override to which version, the advisories each step clears, the names of your workspace packages and dependencies involved, and the step in your package manager.
|
|
80
|
+
|
|
81
|
+
No request ever carries your source code, file contents, file paths, function arguments, start commands, environment variables, secrets or keys other than the API key in its header. The one exception is a flag you choose: `--with-locations` adds relative file paths and line numbers to the result. Before sending, reach checks the payload with the same checks the server runs, and does not send a result that fails them; the server also rejects such an upload, recording only which checks failed, never the payload.
|
|
82
|
+
|
|
83
|
+
You do not have to trust this page: `scan` prints the exact payload before asking to send it, `--dry-run` prints it and stops, and the report's Downloads tab has the payload as it was stored.
|
|
84
|
+
|
|
85
|
+
## Binaries
|
|
86
|
+
|
|
87
|
+
Standalone binaries (no Node.js needed) are not offered yet. Use the npm package above.
|
|
88
|
+
|
|
89
|
+
## Troubleshooting
|
|
90
|
+
|
|
91
|
+
- **"reach could not trace every file production loads", or many `build-output` questions.** reach found no build output. Run your production build (step 4) and scan again. If your build writes somewhere unusual, add that folder to `buildOutput` in `reach.config.json` (`nextDirs` for Next.js `.next` folders, `dist` for anything else).
|
|
92
|
+
- **A missing or refused API key (exit 2).** Check `REACH_API_KEY`, or run `reach login` again. A revoked key is refused; an admin can create a new one.
|
|
93
|
+
- **"cannot reach https://reach.konfirmity.com" (exit 1).** reach needs network access to the server, in CI too. Behind a proxy, allow that host. Offline, use `--advisories <file> --offline`.
|
|
94
|
+
- **A monorepo (workspaces).** Run reach from the repository root, not from one package. The draft lists the workspaces it found; delete those that are not deployed, and check that each deployed app has an entry with the right `kind` (`next-app`, `server`, `worker`, `lambda`, `cli`, `library`).
|
|
95
|
+
- **The first run is slow.** reach reads every file production loads, including dependencies, and type-checks enough of it to follow calls. A large app can take several minutes the first time. That is expected; let it finish.
|
|
96
|
+
- **The scan uploads to the wrong project.** Delete `project` from `reach.config.json` and scan again with `--project-name <name>`.
|
|
97
|
+
- **Anything else.** Send us the command you ran and the last lines it printed. Do not send source code.
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konfirmity/reach",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Tells you which known-vulnerable dependency functions your production code reaches. Runs locally; sends your package list and verdicts, never code.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"homepage": "https://reach.konfirmity.com",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/konfirmity/reach.git",
|
|
10
|
+
"directory": "packages/reach"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://reach.konfirmity.com"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"bin": {
|
|
17
|
+
"reach": "dist/reach.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist/reach.js",
|
|
21
|
+
"docs/CLIENT-QUICKSTART.md",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public",
|
|
27
|
+
"provenance": false
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "bun scripts/build.ts node",
|
|
34
|
+
"compile": "bun scripts/build.ts compile darwin-arm64",
|
|
35
|
+
"compile:all": "bun scripts/build.ts compile",
|
|
36
|
+
"pack:client": "bun pm pack --destination dist-client",
|
|
37
|
+
"corpus": "bun scripts/corpus.ts",
|
|
38
|
+
"prepack": "bun scripts/build.ts node"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@konfirmity/analyzer-ts": "0.0.0",
|
|
42
|
+
"@konfirmity/core": "0.0.0",
|
|
43
|
+
"@types/bun": "latest",
|
|
44
|
+
"@types/semver": "^7.8.0",
|
|
45
|
+
"semver": "^7.8.6"
|
|
46
|
+
}
|
|
47
|
+
}
|