launch-doctor 0.4.2 → 0.4.4
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/CHANGELOG.md +54 -1
- package/README.md +30 -6
- package/dist/src/baseline.d.ts +9 -0
- package/dist/src/baseline.js +26 -0
- package/dist/src/checks/email.js +3 -1
- package/dist/src/checks/secrets.js +3 -1
- package/dist/src/cli.js +240 -88
- package/dist/src/core.d.ts +85 -0
- package/dist/src/core.js +166 -0
- package/dist/src/explanations.d.ts +24 -0
- package/dist/src/explanations.js +562 -0
- package/dist/src/git.d.ts +1 -1
- package/dist/src/git.js +6 -3
- package/dist/src/hooks-setup.js +19 -6
- package/dist/src/index.js +2 -1
- package/dist/src/init.d.ts +17 -0
- package/dist/src/init.js +73 -6
- package/dist/src/live.js +3 -0
- package/dist/src/mcp.d.ts +126 -11
- package/dist/src/mcp.js +294 -148
- package/dist/src/prompt.d.ts +9 -0
- package/dist/src/prompt.js +84 -0
- package/dist/src/report-md.d.ts +14 -0
- package/dist/src/report-md.js +71 -0
- package/dist/src/safe-fs.d.ts +9 -0
- package/dist/src/safe-fs.js +27 -1
- package/dist/src/short-report.d.ts +2 -0
- package/dist/src/short-report.js +5 -0
- package/dist/src/types.d.ts +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,57 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.4] - 2026-12-05
|
|
11
|
+
|
|
12
|
+
A security and usability release from the December 2026 audit ([docs/audits/2026-12-audit.md](docs/audits/2026-12-audit.md)). It changes no rule, severity, finding id or grade: the 50 apps of the corpus scan exactly as before.
|
|
13
|
+
|
|
14
|
+
### Security
|
|
15
|
+
|
|
16
|
+
- **A project that ships with its `.git` folder can no longer run a program through a git submodule.** `--changed`, the MCP `rescan` tool (with no ids or paths) and the Cursor stop hook ran `git diff HEAD`, which runs `git status` inside every checked-out submodule, where a filter driver from the submodule's own config could run. Every `git diff` and `git log` now passes `--ignore-submodules=all`. The plain scan, `--staged` and `--history` were not affected.
|
|
17
|
+
- **No file is written through a folder that is a link.** `--report`, `init` and `init --hooks` wrote through a `.launchdoctor`, `.github`, `.claude` or `.cursor` that was a symlink (or a junction on Windows) to another folder. They now refuse it, as `--record` already did.
|
|
18
|
+
- **MCP tools no longer follow a link out of the project folder.** A link inside the folder the server started in, leading outside it, let `scan_project` and the other tools with a `path` read the outside folder. The real paths are now compared.
|
|
19
|
+
- **Two regular expressions could keep a scan running for minutes** on one very long line in an env file (a 900 KB `EMAIL_FROM=` value, or a long run of spaces after a secret-sounding name). Both are now linear.
|
|
20
|
+
- The release workflow now runs the tests in a job with read-only permissions. Only the publish job holds `contents: write` and `id-token: write`, and it installs with `--ignore-scripts`.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- `explain <n>` explained a different finding than number n in the report when the email DNS check had found something, because it scanned offline while the report and `prompt` do not. It now scans like `prompt`, and accepts `--offline` and `--domain` (0.4.3 refused `explain --offline`).
|
|
25
|
+
- `prompt` and `explain` in a folder with no project files said "found nothing to fix". They now say that no project files were found, and where to run it.
|
|
26
|
+
- `init` and `init --hooks` crashed with a stack trace when a file could not be written (a read-only folder, a file where a folder should be). They now say which file and why, and exit with code 2. A hook file that cannot be written is skipped and the others are still set up.
|
|
27
|
+
- The hint under `explain` is a command you can paste: `npx`, and the folder quoted.
|
|
28
|
+
- `--fail-on` without `--ci` now says on stderr that it was ignored. `--` ends the options, so a folder whose name starts with `-` can be given.
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- When the folder has no `package.json` (or similar) of its own but holds several projects, as a home folder or the Desktop does, the short report ends with a note naming them and how to check one, because the grade mixes them. It is not shown for a workspace root (`pnpm-workspace.yaml`, `workspaces` in `package.json`, `turbo.json`, `nx.json` or `lerna.json`). `--json` is unchanged.
|
|
33
|
+
- On Windows, `init --mcp` prints `claude mcp add launch-doctor -- cmd /c npx -y launch-doctor@0.4 mcp`: a program that starts `npx` without a shell can't find it there. The README and `docs/ai-tools.md` show it. The version range is written without `^`, which cmd.exe drops.
|
|
34
|
+
- `launch-doctor mcp --help` lists all seven tools and the pinned setup commands.
|
|
35
|
+
- The December 2026 audit report, `docs/audits/2026-12-audit.md`, with its follow-ups.
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- The "no colour without a terminal" test runs the CLI in a child process with `FORCE_COLOR`, `CLICOLOR_FORCE` and `NO_COLOR` removed, so it no longer fails on a machine that sets them. The suite now has 430 tests.
|
|
40
|
+
- SECURITY.md describes what the MCP tools do (no network except `scan_url`, only inside their folder), every file Launch Doctor writes, and submodules. CONTRIBUTING.md notes that `npx launch-doctor` inside the repository cannot run the published package, and how to register the working copy's MCP server as `launch-doctor-dev`.
|
|
41
|
+
- **README demo GIF** is now generated with [VHS](https://github.com/charmbracelet/vhs) from `docs/demo/demo.tape`: `npx launch-doctor --demo`, then `npx launch-doctor prompt 1 --demo`. A manual "Demo GIF" workflow regenerates it after a release and opens a pull request. The README loads it from an absolute GitHub URL, so it also shows on npm. VHS is not a package dependency. The old `assets/` tape and sample app are removed, and so is `assets/demo.gif`: the README now shows the new GIF, `docs/demo/demo.gif`. The 0.4.3 README on npm still loads the old file, so that page shows no image until 0.4.4 is published.
|
|
42
|
+
- The README's "Example output" matches the current short report (the `--demo` intro line, and the `--report` Next line on real projects).
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## [0.4.3] - 2026-12-04
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
- **Every finding has a stable id** (`ref` in `--json`): 8 letters and digits from the rule, the file and the text of the line, the same on every scan while the finding is unchanged, even when the line moves. `launch-doctor prompt` accepts it as well as a number.
|
|
50
|
+
- **MCP tools to work through findings one at a time.** `scan_project` now returns a short list (at most 25 findings, critical first, each with its id, rule, file and line), the Security and Launch readiness grades, and coverage notes, instead of every fix prompt at once; text is capped at 12,000 characters. New tools: `explain_finding` (why it matters, how to confirm, how to fix, false-alarm hint), `fix_prompt` (the prompt for one finding), `rescan` (only the files of the given ids or paths, or the files changed since the last commit, and which ids are now fixed) and `grade_history`. They share one core with the CLI.
|
|
51
|
+
- `launch-doctor explain <n|id>` prints the same explanation in the terminal.
|
|
52
|
+
- **`--report`** writes `.launchdoctor/report.md`: every finding with why it matters, how to confirm it, how to fix it and when it is a false alarm, built from the same explanations. Each finding points to its fix prompt (`launch-doctor prompt N`) instead of copying it, and no secret value is written. The short report's Next lines point to it.
|
|
53
|
+
- **`init --mcp`** prints the exact `claude mcp add` command and ready JSON for Cursor and Claude Desktop; it edits no config file. `launch-doctor mcp [folder]` serves a given folder (Claude Desktop does not start servers in your project).
|
|
54
|
+
- `init` adds `.launchdoctor/` to `.gitignore` (creating the file if needed).
|
|
55
|
+
- **An explanation for every rule**, written once in `src/explanations.ts`: what it is, why it matters (what an attacker or a surprise bill looks like), how to confirm it by hand, how to fix it, and when it is a false alarm. A test fails if a rule has none.
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
|
|
59
|
+
- **The MCP server makes no network requests for a project scan** (no email DNS lookups; `offline` is accepted and ignored, and `domain` is gone). Only `scan_url` uses the network, with the address it is given. Every tool reads only inside the folder the server started in: a `path` outside it is refused.
|
|
60
|
+
|
|
10
61
|
## [0.4.2] - 2026-12-04
|
|
11
62
|
|
|
12
63
|
### Added
|
|
@@ -211,7 +262,9 @@ First release.
|
|
|
211
262
|
- `.launchdoctorignore` for silencing findings by id or skipping paths.
|
|
212
263
|
- Support for JavaScript / TypeScript and Python projects.
|
|
213
264
|
|
|
214
|
-
[Unreleased]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.4.
|
|
265
|
+
[Unreleased]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.4.4...HEAD
|
|
266
|
+
[0.4.4]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.4.3...v0.4.4
|
|
267
|
+
[0.4.3]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.4.2...v0.4.3
|
|
215
268
|
[0.4.2]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.4.1...v0.4.2
|
|
216
269
|
[0.4.1]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.4.0...v0.4.1
|
|
217
270
|
[0.4.0]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.3.0...v0.4.0
|
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
|
|
10
|
-

|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
*`npx launch-doctor --demo` scans a sample app full of mistakes: six critical problems, Security F. `prompt 1` prints the fix prompt for the first one.*
|
|
13
13
|
|
|
14
14
|
Launch Doctor scans your project for common problems that hurt apps after launch: leaked API keys, databases anyone can read, endpoints that let one user reach another user's data, payments that can be faked, emails that land in spam, AI endpoints that can run up your bill, missing legal pages, and leftover template defaults. It is built for developers who ship with AI coding tools (Claude Code, Cursor, Lovable, Bolt, Windsurf) and may not read every line of generated code. Every finding is explained in plain English and includes a prompt you can paste straight back into your AI assistant. It has no runtime dependencies, requires no account, sends no telemetry, and your code never leaves your machine.
|
|
15
15
|
|
|
@@ -38,9 +38,12 @@ The full list is in [What it cannot do](#what-it-cannot-do).
|
|
|
38
38
|
|
|
39
39
|
## Example output
|
|
40
40
|
|
|
41
|
-
This is the
|
|
41
|
+
This is the short report `npx launch-doctor --demo` prints in an 80-column terminal. It shows the verdict, a Security grade and a Launch readiness grade, the three things to fix first, a one-line count of everything else, and what to do next. `--verbose` prints the full report with every category and every finding (`--ci`, `--changed`, `--staged`, `--pr-comment` and `scan <url>` always print the full report). On a real project, the Next lines also point to `LAUNCH_FIXES.md`, which starts with one prompt for all the critical problems, and to `--report`, which writes every finding explained to `.launchdoctor/report.md`. The banner only appears in an interactive terminal; in a pipe, in CI or with `--no-banner` the report starts at the "Launch Doctor" line (with `--demo`, after the "Demo:" line). In a wider terminal the header lists the whole stack instead of "+2".
|
|
42
42
|
|
|
43
43
|
```
|
|
44
|
+
|
|
45
|
+
Demo: scanning a sample app with the usual weekend-project mistakes…
|
|
46
|
+
|
|
44
47
|
██╗ █████╗ ██╗ ██╗███╗ ██╗ ██████╗██╗ ██╗
|
|
45
48
|
██║ ██╔══██╗██║ ██║████╗ ██║██╔════╝██║ ██║
|
|
46
49
|
██║ ███████║██║ ██║██╔██╗ ██║██║ ███████║
|
|
@@ -54,7 +57,7 @@ This is the `--demo` report. It shows the verdict, a Security grade and a Launch
|
|
|
54
57
|
██║ ██║██║ ██║██║ ██║ ██║ ██║██╔══██╗
|
|
55
58
|
██████╔╝╚██████╔╝╚██████╗ ██║ ╚██████╔╝██║ ██║
|
|
56
59
|
╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
|
|
57
|
-
Launch Doctor v0.4.
|
|
60
|
+
Launch Doctor v0.4.4 · my-weekend-saas · 13 files · Vite, React, Supabase +2
|
|
58
61
|
|
|
59
62
|
NOT READY TO LAUNCH: 6 critical problems
|
|
60
63
|
|
|
@@ -130,15 +133,36 @@ The report shows two grades: **Security** (secrets, database, access control, pa
|
|
|
130
133
|
|---|---|
|
|
131
134
|
| `npx launch-doctor [folder]` | Check a project: the short report, and `LAUNCH_FIXES.md` with a fix prompt for every problem |
|
|
132
135
|
| `npx launch-doctor --verbose` | The full report: every category and every finding |
|
|
136
|
+
| `npx launch-doctor --report` | Write `.launchdoctor/report.md`: every finding explained, with its fix prompt number |
|
|
137
|
+
| `npx launch-doctor explain <n>` | What finding n means, how to confirm it and how to fix it |
|
|
133
138
|
| `npx launch-doctor --demo` | Check a built-in sample app full of mistakes |
|
|
134
139
|
| `npx launch-doctor prompt <n> --copy` | Copy fix prompt n to the clipboard |
|
|
135
140
|
| `npx launch-doctor --ci` | Exit with code 1 on critical problems, for CI |
|
|
136
141
|
| `npx launch-doctor scan <url>` | Check your deployed site from the outside |
|
|
137
142
|
| `npx launch-doctor init` | Create `.launchdoctorignore` and a GitHub Actions workflow |
|
|
143
|
+
| `npx launch-doctor init --mcp` | Print the setup for Claude Code, Cursor and Claude Desktop |
|
|
138
144
|
| `npx launch-doctor init --hooks` | Check every AI edit and every commit (`--upgrade` moves them to a new version) |
|
|
139
145
|
|
|
140
146
|
Every option, the exit codes and the rarely used flags (`--history-depth`, `--config-from`, `--sarif` and others) are in [docs/cli.md](docs/cli.md).
|
|
141
147
|
|
|
148
|
+
## Use it inside Claude Code / Cursor
|
|
149
|
+
|
|
150
|
+
Launch Doctor is also an MCP server, so your AI coding tool can run the checks, read the findings and fix them with you. Set it up in your project folder:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
claude mcp add launch-doctor -- npx -y "launch-doctor@^0.4.0" mcp
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
On native Windows (PowerShell or cmd), use `claude mcp add launch-doctor -- cmd /c npx -y launch-doctor@0.4 mcp` instead: Claude Code needs `cmd /c` there to start `npx`.
|
|
157
|
+
|
|
158
|
+
`npx launch-doctor init --mcp` prints that command and ready JSON for Cursor (`.cursor/mcp.json`) and Claude Desktop; it changes nothing. Then ask:
|
|
159
|
+
|
|
160
|
+
- *"Scan this app with Launch Doctor."* It runs `scan_project`: the two grades and a short list of findings, each with an id.
|
|
161
|
+
- *"Explain finding 2."* It runs `explain_finding`: why it matters, how to confirm it, how to fix it, and when it is a false alarm.
|
|
162
|
+
- *"Fix the top issue, then rescan."* It gets the fix prompt with `fix_prompt`, makes the change, and runs `rescan` on that finding to check it is gone.
|
|
163
|
+
|
|
164
|
+
The server only reads your project folder, writes nothing, never returns secret values (only the file, the line and a masked hint), and uses the network only when you ask it to check a live site with `scan_url`. The tools and their options: [docs/ai-tools.md](docs/ai-tools.md#mcp-server).
|
|
165
|
+
|
|
142
166
|
## Using with AI coding tools
|
|
143
167
|
|
|
144
168
|
`LAUNCH_FIXES.md` starts with one prompt for all the critical problems, then has one prompt per problem with the file, the line and the risk in plain English. Paste them one at a time into Claude Code, Cursor, Windsurf, Lovable or Bolt, or copy one with `npx launch-doctor prompt <n> --copy`. `npx launch-doctor init --hooks` makes Claude Code and Cursor run the check after every edit, and `npx launch-doctor mcp` lets your AI tool run it itself. Details: [docs/ai-tools.md](docs/ai-tools.md).
|
|
@@ -163,7 +187,7 @@ Launch Doctor analyzes your codebase locally on your device. Your source code, f
|
|
|
163
187
|
- **No telemetry:** Launch Doctor does not collect usage data or phone home.
|
|
164
188
|
- **Git history analysis (`--history`):** Runs local `git log` commands directly on your system without network requests.
|
|
165
189
|
- **Pull request comments (`--pr-comment`):** calls the GitHub API with the workflow's token to read the pull request's changed files and post comments. It only runs on GitHub Actions and sends finding titles, explanations, fix prompts and file paths, never your source code.
|
|
166
|
-
- **MCP server (`mcp`):** talks to your AI tool over stdin and stdout only; it opens no port. Its tools make
|
|
190
|
+
- **MCP server (`mcp`):** talks to your AI tool over stdin and stdout only; it opens no port. Its project tools make no network requests at all (no email DNS lookups) and only read inside the folder the server started in. Only `scan_url` uses the network: the requests to the site you name, which must be a public site.
|
|
167
191
|
- **Hooks (`init --hooks`):** the hooks themselves make no network requests beyond `npx --yes "launch-doctor@^X.Y.0"`, which downloads the package from the npm registry the first time if it isn't installed. `--changed` and `--staged` skip the email DNS lookups.
|
|
168
192
|
- **Grade history and badge (`--record`):** written to `.launchdoctor/` in your project. No badge service is involved and nothing is sent anywhere.
|
|
169
193
|
- **Scheduled monitoring (`init --monitor`):** the workflow runs on GitHub's servers and makes the same requests as the commands it runs (`npx`, the email DNS lookups, and `scan` when `LAUNCH_DOCTOR_URL` is set), then pushes its commit to the `launch-doctor-grades` branch of your repository.
|
|
@@ -209,7 +233,7 @@ For apps that handle significant money or sensitive personal or health data, use
|
|
|
209
233
|
|
|
210
234
|
## How it is tested
|
|
211
235
|
|
|
212
|
-
-
|
|
236
|
+
- 430 automated tests run on every change, on Windows, macOS and Linux, with Node.js 22 and 24 (a few need FIFOs, Linux or a POSIX shell, and are skipped where those are missing).
|
|
213
237
|
- A stress-test harness (`scripts/stress/`, see [CONTRIBUTING.md](CONTRIBUTING.md#stress-tests)) runs Launch Doctor against hostile inputs: repositories whose git settings try to run programs, symlink loops and FIFOs, files built to make a regular expression backtrack, terminal escape sequences, hostile servers for `scan`, and MCP requests to private addresses. Before 0.4.0 it found 10 security problems; each is fixed and has a regression test, and the whole suite now passes on Windows and Linux.
|
|
214
238
|
- Every check that existed in 0.2 has been confirmed against a small project (or fake site) that contains exactly that problem, and every command in this README has been run (the `scan` examples against a local test site rather than a real one).
|
|
215
239
|
- The features new in 0.3.0 (the GitHub Action, the MCP server, mobile apps, and Clerk, Convex, Appwrite, Paddle and Lemon Squeezy) have their own tests and were spot-checked by hand, which found and fixed two bugs before release. They have been tried less than the older checks. Posting pull request comments is tested against a fake GitHub API; it has not yet run on many real pull requests.
|
package/dist/src/baseline.d.ts
CHANGED
|
@@ -6,6 +6,15 @@ export declare const BASELINE_FILE = ".launchdoctor-baseline.json";
|
|
|
6
6
|
* It doesn't include the line number, so it survives lines moving up or down.
|
|
7
7
|
*/
|
|
8
8
|
export declare function fingerprint(ctx: ProjectContext, f: Finding): string;
|
|
9
|
+
/** The text of a finding's line with whitespace collapsed, or '' when it has no line. */
|
|
10
|
+
export declare function lineContext(ctx: ProjectContext, f: Finding): string;
|
|
11
|
+
/** A short stable id from the rule id, the file and the line's text. */
|
|
12
|
+
export declare function findingRef(id: string, file: string, context: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Give every finding its ref. Two findings that would get the same one (same rule, same file, no line) are told
|
|
15
|
+
* apart by their order, which is stable because the checks run in a fixed order.
|
|
16
|
+
*/
|
|
17
|
+
export declare function assignRefs(findings: Finding[], contextOf: (f: Finding) => string): void;
|
|
9
18
|
/**
|
|
10
19
|
* Fingerprints in the project's baseline file, or null if there is none (or it can't be read).
|
|
11
20
|
* With `configFrom`, the file is read from that git ref instead of the working folder.
|
package/dist/src/baseline.js
CHANGED
|
@@ -20,6 +20,32 @@ export function fingerprint(ctx, f) {
|
|
|
20
20
|
const hash = createHash('sha256').update(text).digest('hex').slice(0, 16);
|
|
21
21
|
return `${f.id}|${file}|${hash}`;
|
|
22
22
|
}
|
|
23
|
+
/** The text of a finding's line with whitespace collapsed, or '' when it has no line. */
|
|
24
|
+
export function lineContext(ctx, f) {
|
|
25
|
+
const file = f.location?.file;
|
|
26
|
+
const line = f.location?.line;
|
|
27
|
+
if (!file || !line)
|
|
28
|
+
return '';
|
|
29
|
+
return (ctx.file(file)?.content.split(/\r?\n/)[line - 1] ?? '').trim().replace(/\s+/g, ' ');
|
|
30
|
+
}
|
|
31
|
+
/** A short stable id from the rule id, the file and the line's text. */
|
|
32
|
+
export function findingRef(id, file, context) {
|
|
33
|
+
return createHash('sha256').update(`${id}\n${file}\n${context}`).digest('hex').slice(0, 8);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Give every finding its ref. Two findings that would get the same one (same rule, same file, no line) are told
|
|
37
|
+
* apart by their order, which is stable because the checks run in a fixed order.
|
|
38
|
+
*/
|
|
39
|
+
export function assignRefs(findings, contextOf) {
|
|
40
|
+
const seen = new Map();
|
|
41
|
+
for (const f of findings) {
|
|
42
|
+
const file = f.location?.file ?? '';
|
|
43
|
+
const base = findingRef(f.id, file, contextOf(f));
|
|
44
|
+
const n = seen.get(base) ?? 0;
|
|
45
|
+
seen.set(base, n + 1);
|
|
46
|
+
f.ref = n ? findingRef(f.id, file, `${contextOf(f)}\n#${n}`) : base;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
23
49
|
/**
|
|
24
50
|
* Fingerprints in the project's baseline file, or null if there is none (or it can't be read).
|
|
25
51
|
* With `configFrom`, the file is read from that git ref instead of the working folder.
|
package/dist/src/checks/email.js
CHANGED
|
@@ -48,7 +48,9 @@ const DKIM_SELECTORS = [
|
|
|
48
48
|
'pm',
|
|
49
49
|
'brevo1',
|
|
50
50
|
];
|
|
51
|
-
|
|
51
|
+
// Every part is bounded (a local part has at most 64 characters, a domain label 63), so a long run of letters with no
|
|
52
|
+
// "@" (a crafted .env value) is read in linear time. Unbounded, it took quadratic time and a 900 KB line hung the scan.
|
|
53
|
+
const EMAIL_RE = /[A-Za-z0-9._%+-]{1,64}@((?:[A-Za-z0-9-]{1,63}\.){1,10}[A-Za-z]{2,24})/;
|
|
52
54
|
function collectSenders(ctx) {
|
|
53
55
|
const out = [];
|
|
54
56
|
const add = (m, text) => {
|
|
@@ -493,7 +493,9 @@ export function holdsRealSecret(content) {
|
|
|
493
493
|
const kv = /^\s*(?:export\s+)?([A-Za-z_]\w*)\s*=\s*(.*)$/.exec(line);
|
|
494
494
|
if (!kv || !SECRETISH_NAME.test(kv[1]))
|
|
495
495
|
continue;
|
|
496
|
-
|
|
496
|
+
// Cut a trailing " # comment" with a linear search: /\s+#.*$/ took quadratic time on a long run of spaces.
|
|
497
|
+
const comment = kv[2].search(/\s#/);
|
|
498
|
+
const value = comment < 0 ? kv[2] : kv[2].slice(0, comment);
|
|
497
499
|
if (envValueLooksReal(value))
|
|
498
500
|
return true;
|
|
499
501
|
}
|