launch-doctor 0.3.0 → 0.4.1
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 +92 -6
- package/LICENSE +1 -0
- package/README.md +138 -22
- package/dist/src/access.d.ts +52 -0
- package/dist/src/access.js +482 -0
- package/dist/src/baseline.d.ts +6 -3
- package/dist/src/baseline.js +15 -8
- package/dist/src/changed.d.ts +12 -0
- package/dist/src/changed.js +34 -0
- package/dist/src/checks/access.d.ts +7 -0
- package/dist/src/checks/access.js +868 -0
- package/dist/src/checks/costs.d.ts +7 -0
- package/dist/src/checks/costs.js +14 -6
- package/dist/src/checks/database.js +79 -3
- package/dist/src/checks/first-impressions.js +22 -2
- package/dist/src/checks/legal.js +3 -1
- package/dist/src/checks/monitoring.js +8 -5
- package/dist/src/checks/payments.js +10 -2
- package/dist/src/checks/secrets.d.ts +8 -0
- package/dist/src/checks/secrets.js +82 -9
- package/dist/src/checks/supabase-storage.d.ts +31 -0
- package/dist/src/checks/supabase-storage.js +216 -0
- package/dist/src/cli.js +175 -12
- package/dist/src/demo.js +1 -0
- package/dist/src/detect.d.ts +1 -1
- package/dist/src/detect.js +1 -1
- package/dist/src/fixes.js +8 -5
- package/dist/src/git.d.ts +25 -0
- package/dist/src/git.js +121 -0
- package/dist/src/github.d.ts +11 -1
- package/dist/src/github.js +56 -14
- package/dist/src/grades.d.ts +42 -0
- package/dist/src/grades.js +163 -0
- package/dist/src/history.js +17 -3
- package/dist/src/hook.d.ts +13 -0
- package/dist/src/hook.js +96 -0
- package/dist/src/hooks-setup.d.ts +24 -0
- package/dist/src/hooks-setup.js +187 -0
- package/dist/src/ignore.d.ts +36 -0
- package/dist/src/ignore.js +164 -0
- package/dist/src/index.js +28 -3
- package/dist/src/init.d.ts +32 -2
- package/dist/src/init.js +120 -6
- package/dist/src/live.d.ts +13 -1
- package/dist/src/live.js +111 -23
- package/dist/src/mcp.js +7 -2
- package/dist/src/net-guard.d.ts +42 -0
- package/dist/src/net-guard.js +147 -0
- package/dist/src/pinned-http.d.ts +31 -0
- package/dist/src/pinned-http.js +104 -0
- package/dist/src/project.d.ts +34 -5
- package/dist/src/project.js +145 -111
- package/dist/src/report.d.ts +4 -0
- package/dist/src/report.js +13 -0
- package/dist/src/routes.d.ts +10 -0
- package/dist/src/routes.js +21 -4
- package/dist/src/safe-fs.d.ts +19 -0
- package/dist/src/safe-fs.js +77 -0
- package/dist/src/sanitize.d.ts +17 -0
- package/dist/src/sanitize.js +90 -0
- package/dist/src/sarif.js +1 -1
- package/dist/src/summary.d.ts +4 -0
- package/dist/src/summary.js +9 -4
- package/dist/src/types.d.ts +24 -0
- package/dist/src/util.d.ts +1 -1
- package/dist/src/util.js +1 -1
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,11 +7,95 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.1] - 2026-12-04
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Grade history:** `--record` saves the grade of a full scan to `.launchdoctor/grades.json` (date, grade, score, counts, Launch Doctor version and the commit scanned; no finding text, file names or keys; the newest 200 entries). Every full scan then shows the last recorded grade under the overall grade, and `launch-doctor grades [folder]` lists the history (`--json` for the raw list). `--record` is refused with `--changed`, `--staged`, `--only`, `--skip` and `--demo`, whose grades aren't comparable. The file is read like the baseline (a regular file only) and every entry is checked before use.
|
|
15
|
+
- **README badge:** `--record` also draws `.launchdoctor/badge.svg` locally (no badge service), with the grade in a color that keeps 4.5:1 contrast with its white text. With scheduled monitoring, the README points at the copy on the `launch-doctor-grades` branch: ``.
|
|
16
|
+
- **Scheduled monitoring:** `launch-doctor init --monitor` adds `.github/workflows/launch-doctor-monitor.yml`. Every Monday (or when started by hand) it reads the grade history from the `launch-doctor-grades` branch, runs `--record --ci`, so a new critical problem fails the run and GitHub emails you; checks the deployed site too when the repository variable `LAUNCH_DOCTOR_URL` is set (passed through an environment variable, never pasted into the script); and commits `grades.json` and `badge.svg` to the `launch-doctor-grades` branch, also after a failed check. That branch is created on the first run as an orphan branch holding only those two files; nothing is committed to the default branch, so it works with a protected `main` and adds no commits to it. It runs Launch Doctor pinned to the version that created it, and `init --monitor` prints the badge line with your repository filled in when `origin` is on GitHub.
|
|
17
|
+
|
|
18
|
+
### Security
|
|
19
|
+
|
|
20
|
+
- `scan <url>` is no longer open to DNS rebinding. Requests are made with `node:http` and `node:https` instead of `fetch`, and each one connects only to the addresses that were checked for it, so DNS can't hand the connection a private address after the check said public. The host name is still used for the `Host` header and for HTTPS (the server name and the certificate check). Redirects (one hop at a time, at most 5), the per-request timeout, the 3 MB body cap (now counted after decompression) and gzip, deflate and Brotli bodies work as before.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Releases are published to npm with trusted publishing: the Release workflow proves who it is to npm with a short-lived GitHub token, so no npm token is stored anywhere, and every version gets a provenance statement linking it to its tag and workflow run. A version that is already on npm is skipped, so a re-run is safe. CONTRIBUTING.md has the one-time npm setup.
|
|
25
|
+
- `docs/roadmap.md` lists the milestones planned after the 0.5.0 engine rewrite, the rules every milestone follows (local-first, opt-in network access, no secrets in output, approval for new dependencies), and what is deliberately not planned, with the reasons. CONTRIBUTING.md, the README and `docs/architecture.md` link to it.
|
|
26
|
+
|
|
27
|
+
## [0.4.0] - 2026-12-02
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- New category: **Access control** (`access`, weight 3). It looks for the authorization mistakes that come up most in AI-built apps:
|
|
32
|
+
- `server-action-no-auth`: Next.js Server Actions that change data without checking who is calling (every exported action is a public POST endpoint). Actions in one file are grouped into one finding. When a blocking middleware covers every page, it becomes a checklist item instead.
|
|
33
|
+
- `api-write-no-auth`: Next.js route handlers, Express routes, tRPC procedures and FastAPI, Flask and Django views that change data without a sign-in check, in apps that have accounts. Webhooks with a signature check and sign-in, sign-up and contact flows are skipped.
|
|
34
|
+
- `missing-ownership-check`: signed-in handlers that load or change a record by an id from the request, with no owner filter, owner comparison, permission helper or admin check (IDOR). It covers Prisma, Drizzle, Mongoose, Sequelize, Supabase with the service-role key, Firebase Admin, SQLAlchemy and Django. An owner filter taken from the request body does not count.
|
|
35
|
+
- `user-metadata-role` (critical on the server, warning in the browser): roles or plans read from Supabase `user_metadata` or Clerk `unsafeMetadata`, which users can edit themselves, in code, RLS policies and SQL functions.
|
|
36
|
+
- `mass-assignment`: whole request bodies, form data or Server Action arguments saved to the database, and DRF serializers or Django forms with `fields = "__all__"`.
|
|
37
|
+
- `client-only-admin-check`: admin checks (a role or an admin email) that only exist in browser code, with nothing matching on the server or in database rules.
|
|
38
|
+
- `jwt-not-verified` and `jwt-none-algorithm` (critical): tokens decoded without checking the signature, or the `none` algorithm allowed.
|
|
39
|
+
- `supabase-getsession-server`: `supabase.auth.getSession()` trusted in server code without `getClaims()` or `getUser()`.
|
|
40
|
+
- Checklist: try to open another user's data with a second test account.
|
|
41
|
+
- The demo app has an admin page that is only protected in the browser.
|
|
42
|
+
- `supabase-signed-in-read-policy` (warning): a Supabase policy like `for select to authenticated using (true)`, which lets anyone who creates an account read every row. The fix prompt replaces it with an owner check (`auth.uid() = user_id`).
|
|
43
|
+
- Supabase Storage checks. `supabase-public-bucket` (warning): a bucket made public in a SQL migration, `supabase/config.toml` or `createBucket(..., { public: true })` whose name suggests private files (invoices, documents, IDs, backups...). `supabase-storage-open-write`: storage policies that only check the bucket, so signed-out visitors can replace or delete files (critical), upload files (warning), or any signed-in user can replace or delete everyone's files (warning). Apps that use Storage get a checklist item to review their buckets on the dashboard, listing the public buckets found in the code. Storage policies are no longer reported as policies on an "objects" table.
|
|
44
|
+
- `--config-from <ref>` reads `.launchdoctorignore` and `.launchdoctor-baseline.json` from a git branch, tag or commit instead of the folder, and ignores inline `launch-doctor-ignore` comments on lines changed since that ref. A ref that doesn't exist is an error, not a silent pass.
|
|
45
|
+
|
|
46
|
+
- `scripts/corpus.mjs`: a test set of 50 public open-source apps, cloned at pinned commits into a git-ignored folder (none of their code is stored in this repository). `fetch` clones them, `snapshot` and `diff` save and compare the findings per app so every rule change shows what it added and removed, `review` prints everything, and `list` shows each app's license. See CONTRIBUTING.md.
|
|
47
|
+
- `scripts/stress/`: a stress-test harness for contributors. It runs scale scenarios (20,000 files, 1 GB of source, 5,000 commits of history) and security scenarios (regex backtracking, symlink loops and special files, malicious git configs with a canary, terminal escapes, hostile servers for `scan <url>`, MCP `scan_url` to private addresses). Generated projects go to the system temp folder, outside the repository. See CONTRIBUTING.md.
|
|
48
|
+
- `launch-doctor init --hooks` sets up hooks that check every AI edit and every commit, merging into existing files and never replacing them: a Claude Code `PostToolUse` hook in `.claude/settings.json` (Claude gets the problem and its fix prompt right after it writes a file, via exit code 2), a Cursor `stop` hook in `.cursor/hooks.json` (problems in the files the agent changed come back as a follow-up message), and a git pre-commit hook (only critical problems stop the commit; `--no-verify` skips it; it is silent when all is well). Settings files that aren't valid JSON, and pre-commit hooks written in another language, are left alone.
|
|
49
|
+
- `--changed` (edited, staged and new files since the last commit) and `--staged` (what the next commit will contain) report only on those files. The whole project is still read so cross-file checks keep working, the email DNS lookups are skipped, `LAUNCH_FIXES.md` is not written, and the report says it covers some files only. The README lists what they can miss. They can't be combined with `--update-baseline`, `--pr-comment` or `--history`.
|
|
50
|
+
- `launch-doctor hook <claude|cursor>`: the command the hooks run. It reads the tool's JSON from stdin. It only exits with a code that reaches the AI when it has found problems; if anything unexpected happens it exits 0, so a hook never gets in the way of the work.
|
|
51
|
+
|
|
52
|
+
### Security
|
|
53
|
+
|
|
54
|
+
- A project shipped with its `.git` folder could make `--history`, `--changed` and `--config-from` run programs through its git settings (filter drivers and textconv; only `core.fsmonitor` was turned off before). Every git command Launch Doctor runs now also turns off filter drivers, textconv and external diff drivers, the pager, signature checks and hooks; `--config-from` reads files with `git cat-file` instead of `git show`; and git commands have a time limit. A plain `git clone` never copies these settings, so cloned repositories were not affected. Found with the new stress harness.
|
|
55
|
+
- `init --hooks` on a project in a subfolder wrote the folder name into the pre-commit hook in double quotes, so a folder named like `app$(...)` or ``app`...` `` ran that command on every commit. The name is now in single quotes (a single quote in it is escaped), and a name that starts with `-` gets `./` in front so it can't be read as an option. Hooks written by earlier releases keep their old line; run `init --hooks` again after removing the launch-doctor block to get the new one.
|
|
56
|
+
- `scan <url>` followed whatever a site pointed it to: a script on a LAN address, a source map on the cloud metadata address (`169.254.169.254`), redirects to `127.0.0.1` or `[::1]`. The MCP `scan_url` tool also accepted private addresses directly. Now every request is checked before it is sent, including each redirect hop (redirects are followed one at a time, at most 5): its host is resolved, and the request is refused unless every address is public. Every spelling of loopback, private, link-local, metadata, IPv6 loopback/unique local/link-local and IPv4-in-IPv6 addresses is covered. The CLI still scans a private address you type yourself (your own dev server); the MCP tool only scans public sites. The report says when requests were skipped. One known gap remains (DNS rebinding, see SECURITY.md); the fix is planned for 0.4.1.
|
|
57
|
+
- SECURITY.md now says that the MCP `scan_project` tool scans any folder it is given, not only the folder the server started in, and why that is on purpose.
|
|
58
|
+
- A `.launchdoctorignore`, baseline file or nested `.git` that was a FIFO, or a link to `/dev/zero`, made a scan hang (Linux and macOS). A `.launchdoctorignore` that linked to a file outside the project was read, and its one-word lines appeared in the report as unknown ignore ids. These files are now read only when they are regular files in the project (checked before and after opening, without following links or blocking); anything else counts as no file. A nested `.git` that is neither a folder nor a regular file is never opened, and its folder is skipped as another repository.
|
|
59
|
+
- A project could hold `LAUNCH_FIXES.md` (or the baseline, a `--sarif` target, `.claude/settings.json`, `.cursor/hooks.json` or the pre-commit hook) as a symlink to a file outside it, and a scan or `init --hooks` overwrote that file. Launch Doctor now writes only to regular files or new ones (without following links where the OS allows), and says it couldn't write the file otherwise. `init --hooks` leaves such a file alone and says why.
|
|
60
|
+
- Seven regular expressions took quadratic time on a crafted 100 KB file (a long run of letters, newlines or spaces, or a very long URL), so a scan hung for minutes: the mass-assignment and tRPC checks, import parsing (two), Server Action detection, the Python JWT check and the privacy-policy URL check. Eight more with the same shape were fixed as well (tRPC procedure names, parameter and import names, `supabase/config.toml` buckets, and the `.git/config` check in `scan <url>`). Each one is rewritten so it can only match one way; the stress harness's regex fuzzer (94 shapes and 700 words, each 100 KB in 14 file types) now finds no hang and no regex slower than 1 second, and a regression test scans every input that used to hang. Scanning the 50 corpus apps gives the same findings as before.
|
|
61
|
+
- A `.launchdoctorignore` (or, without git, a `.gitignore`) with 100,000 lines, or with globs like `**/**/**/x` or `a*a*a*...b`, made a scan run for minutes: every rule was turned into a regular expression again for every path, and some of those backtracked. Rules are now compiled once and matched without backtracking (time grows with path length times pattern length, whatever the glob), and runs of `*` collapse into one. Only the first 1,000 lines of `.launchdoctorignore` are used; when there are more, the report says how many were skipped (`ignoreLinesSkipped` in `--json`, a new field). The 100,000-line case now takes about 2.5 seconds. Matching gives the same answers as before, except that `a/**/**/b` now also matches `a/b`, as it does in git.
|
|
62
|
+
- Text from scanned files (file names, table names, the package name) reached the terminal as it was, so a file could clear the screen, change the window title or hide text with escape sequences. Terminal control characters (and Unicode bidirectional controls) are now removed from every report, in every output. In pull request comments, the job summary and `LAUNCH_FIXES.md`, that text is also escaped: it can no longer @mention people, add links or images, or inject HTML, and file paths go in code spans a backtick in the name can't end. The hidden marker in inline comments no longer contains spaces, so a finding in a file whose path has a space is no longer posted again on every run.
|
|
63
|
+
- There was no limit on the total size of the files a scan reads: 1,000 files of just under 1 MB used about 2 GB of memory. Reading now stops after 128 MB of text (ten times the largest of the 50 corpus apps, which reads 12.7 MB), and the report says so, like the 20,000-file limit (`byteLimitReached` in `--json`, a new field). The same project now peaks at about 380 MB.
|
|
64
|
+
- The GitHub Action read `.launchdoctorignore` and `.launchdoctor-baseline.json` from the pull request itself, so a pull request could silence its own findings by adding lines to them. On pull requests it now fetches the base commit and reads both files from there. Inline `launch-doctor-ignore` comments the pull request adds or changes are ignored as well (with `--config-from`, comments on lines changed since the ref are not trusted); comments already on the base branch keep working.
|
|
65
|
+
- The hooks `init --hooks` writes are now pinned to the current minor range (`npx --yes "launch-doctor@^0.4.0" hook claude`, the same for Cursor and the pre-commit hook), read from `package.json`. Before, they ran `npx --yes launch-doctor`, so every hook installed whatever version was newest on npm without asking. The package is in double quotes because `^` means something to `cmd.exe` and to zsh. Hooks written by earlier releases are recognized and left as they are (never duplicated); edit the version in them by hand to move to a newer release.
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- An Express route registered before `app.use(requireAuth)` counted as protected, but Express runs middleware in the order it is registered, so the route was open. Sign-in middleware added with `app.use` now only covers the routes registered after it in the same file, so such a route is reported by the access-control checks (`api-write-no-auth`). Middleware registered in another file is still not tracked; that comes with the 0.5.0 engine. Scanning the 50 corpus apps shows no change.
|
|
70
|
+
- A sign-in helper that was only imported (`import { getServerSession } from 'next-auth'`, never called) counted as a sign-in check, so an unprotected AI route (`ai-endpoint-no-auth`) or data-changing endpoint (`api-write-no-auth`) in that file, or in a file that imports such a module, went unreported. Import and `require` lines no longer count; the helper has to appear in the code. A call whose result is never checked still counts; that needs the 0.5.0 engine. Scanning the 50 corpus apps shows no change.
|
|
71
|
+
- CLI tools that contain web-like sample code were misclassified as web apps. A project whose package.json declares a `bin` no longer counts as a website just because its source contains text like `"use server"` or `app.get(`, unless it depends on a server framework (Express, Fastify, Hono, Koa, NestJS or hapi), a frontend package or has an `index.html`. This removes the "No error tracking" warning from Launch Doctor's own scan.
|
|
72
|
+
- Public forms are matched by their whole name, not their first letters. `subscribe\w*` and `contact\w*` also exempted admin actions such as `subscribers_delete`, `contacts_export` and `contact_admin`, so a missing sign-in or ownership check on them went unreported. Now only the action itself is treated as public (`subscribe`, `unsubscribe`, `contact`, `contact_form`, `contact_submit`, `newsletter_signup`, `join_waitlist`, feedback, inquiry, `consume_link`, bounces, ping), and a name or URL that also says delete, update, edit, export, list, admin, remove or all is checked like any other endpoint. The same rule applies to URLs (`/api/contact/export`, `/api/contact_admin/:id`). Scanning the 50 corpus apps shows no other change.
|
|
73
|
+
- The pull request summary comment could go over GitHub's 65,536-character limit (with long paths, it reached 162,000 characters), and then GitHub refused it and no summary was posted. Its lists now get shorter until the comment fits (under 60,000 characters), long titles are cut at 300 characters, and a cut list says how many findings were left out and links to the run's job summary, which lists them all.
|
|
74
|
+
|
|
75
|
+
False alarms found by running Launch Doctor on 50 real open-source apps:
|
|
76
|
+
|
|
77
|
+
- A committed `.env` file is critical only when it holds something that looks like a real secret. A file that only has placeholders (`changethis`, `your_key_here`, `test_secret`), switches, public keys, Supabase's local-development keys or a database URL for your own machine is a warning, because nothing has leaked yet. The same applies to `env-not-ignored`.
|
|
78
|
+
- `.example.env` (the word "example" before `env`) is a template, like `.env.example`, not a real env file.
|
|
79
|
+
- Public variables that are settings are no longer called secrets: names with `DISABLE`, `ENABLE`, `REQUIRE`, `PATTERN`, `REGEX` and similar words (`NEXT_PUBLIC_PASSWORD_REGEX_PATTERN`), and variables that are set to or compared with `true`, `false` or a number (`NEXT_PUBLIC_AUTH_PASSWORD=true`).
|
|
80
|
+
- The keys that `supabase start` prints for a local database (their token says `iss: supabase-demo`) are the same for everyone and are no longer reported as a leaked `service_role` key.
|
|
81
|
+
- A Stripe webhook that checks the signature in Python (`stripe.Webhook.construct_event`), Ruby (`Stripe::Webhook.construct_event`), PHP, Go or Java is no longer reported as unverified. Before, only the JavaScript spelling was recognised.
|
|
82
|
+
- `express.json({ verify })`, which keeps the raw body for the webhook on purpose (Stripe's own samples do this), is no longer reported as a body parser that breaks signature checks.
|
|
83
|
+
- Importing a helper from an AI SDK in browser code (`together-ai/lib/ChatCompletionStream.mjs`) is no longer reported as calling a paid API from the browser. The package's main import still is.
|
|
84
|
+
- Django: a function in `views.py` that no URL points at (its name starts with `_`, or it is handed a model object) is not an endpoint. A view that takes a secret in its URL (a signed link, a ping key, a token), or that is a contact or inquiry form, is not reported as unprotected. A signature check with `django.core.signing` or `itsdangerous` counts as proof of who is calling.
|
|
85
|
+
- A handler guarded by a service-to-service check such as `authenticateVoiceGateway(request)` is not reported for a missing owner check, since the caller is a machine, not a user.
|
|
86
|
+
- A hand-written `ErrorBoundary` (a class, `react-error-boundary`, Remix and React Router's exported `ErrorBoundary`, or a router's `errorElement` / `errorComponent`) now counts in any framework, even when `next` is a dependency somewhere in the repository.
|
|
87
|
+
- `hardcoded-localhost` no longer reports localhost in a fallback or development-only branch written a few lines from the URL (`dev ? 'http://localhost:5173' : ...`, `process.env.X ?? ... 'http://localhost:3000'`, `DEFAULT_HOST`, `window.location.origin === ...`), in comments, in setup, seed and docs or example folders, in test tool config, or in framework settings files.
|
|
88
|
+
|
|
89
|
+
### Changed
|
|
90
|
+
|
|
91
|
+
- SECURITY.md lists every network request Launch Doctor is expected to make: email DNS lookups, the `scan <url>` requests (including Supabase), the GitHub API calls for pull request comments, and the MCP server's tools.
|
|
92
|
+
- LICENSE, README and package.json credit Namay Singh for early development.
|
|
93
|
+
|
|
10
94
|
## [0.3.0] - 2026-11-27
|
|
11
95
|
|
|
12
96
|
### Added
|
|
13
97
|
|
|
14
|
-
- GitHub Action (`uses: SHARAJ379/
|
|
98
|
+
- GitHub Action (`uses: SHARAJ379/Launch-Doctor@v0`): runs the checkup on pull requests, posts inline comments with fix prompts on the lines the pull request adds, and keeps one summary comment up to date. Inputs: `path`, `fail-on` (`critical`, `warning` or `never`), `comment`, `args`, `github-token`.
|
|
15
99
|
- `--pr-comment` posts the same pull request comments from the CLI. It never fails the run: outside a pull request, or without write access, it explains why it skipped.
|
|
16
100
|
- When `GITHUB_OUTPUT` is set, the grade, score, critical and warning counts are saved as step outputs.
|
|
17
101
|
- `launch-doctor mcp` runs a Model Context Protocol server, so Claude Code, Cursor and other AI tools can run the checkup themselves. Tools: `scan_project` (grade, findings with file, line and fix prompt, and the checklist), `scan_url` (the live site scan) and `list_checks`. Stdio only, no dependencies, protocol versions 2024-11-05 to 2025-11-25.
|
|
@@ -100,8 +184,10 @@ First release.
|
|
|
100
184
|
- `.launchdoctorignore` for silencing findings by id or skipping paths.
|
|
101
185
|
- Support for JavaScript / TypeScript and Python projects.
|
|
102
186
|
|
|
103
|
-
[Unreleased]: https://github.com/SHARAJ379/
|
|
104
|
-
[0.
|
|
105
|
-
[0.
|
|
106
|
-
[0.
|
|
107
|
-
[0.1
|
|
187
|
+
[Unreleased]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.4.1...HEAD
|
|
188
|
+
[0.4.1]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.4.0...v0.4.1
|
|
189
|
+
[0.4.0]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.3.0...v0.4.0
|
|
190
|
+
[0.3.0]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.2.1...v0.3.0
|
|
191
|
+
[0.2.1]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.2.0...v0.2.1
|
|
192
|
+
[0.2.0]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.1.0...v0.2.0
|
|
193
|
+
[0.1.0]: https://github.com/SHARAJ379/Launch-Doctor/releases/tag/v0.1.0
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
**A pre-launch checkup for vibe-coded apps: one command, an A-F grade, and a fix prompt for every problem.**
|
|
4
4
|
|
|
5
|
-
[](https://github.com/SHARAJ379/Launch-Doctor/actions/workflows/ci.yml)
|
|
6
6
|
[](https://www.npmjs.com/package/launch-doctor)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
|
|
10
|
-
Launch Doctor
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
*A sample app full of mistakes scores an F with six critical issues; a prepared app scores an A.*
|
|
13
|
+
|
|
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.
|
|
11
15
|
|
|
12
16
|
## Read this first
|
|
13
17
|
|
|
@@ -45,13 +49,14 @@ Requires Node.js 22 or newer. That is the version range the automated tests cove
|
|
|
45
49
|
This is the `--demo` report, shortened. On a real project the last line tells you where `LAUNCH_FIXES.md` was saved (the demo doesn't write it).
|
|
46
50
|
|
|
47
51
|
```
|
|
48
|
-
Launch Doctor v0.
|
|
49
|
-
Checked my-weekend-saas ·
|
|
52
|
+
Launch Doctor v0.4.1
|
|
53
|
+
Checked my-weekend-saas · 13 files · Vite, React, Supabase, Stripe, OpenAI
|
|
50
54
|
|
|
51
55
|
Overall grade F Not ready to launch: fix 6 critical issues first
|
|
52
56
|
|
|
53
57
|
F Secrets & keys 2 critical · 1 to fix · 1 to check
|
|
54
58
|
F Database & backups 2 critical · 1 to check
|
|
59
|
+
B Access control 1 to fix · 1 to check
|
|
55
60
|
F Payments 1 critical · 2 to check
|
|
56
61
|
F AI & API costs 1 critical · 1 to fix · 1 to check
|
|
57
62
|
B Email delivery 1 to fix · 3 to check
|
|
@@ -89,10 +94,11 @@ flowchart TD
|
|
|
89
94
|
LoadContext --> DetectStack["3. Technology Stack & Environment Detection"]
|
|
90
95
|
DetectStack --> ChecksSuite
|
|
91
96
|
|
|
92
|
-
subgraph ChecksSuite["4. Evaluation across
|
|
97
|
+
subgraph ChecksSuite["4. Evaluation across 9 Check Modules"]
|
|
93
98
|
direction TB
|
|
94
99
|
C1["Secrets & Keys Scan"]
|
|
95
100
|
C2["Database Security & RLS"]
|
|
101
|
+
C2b["Access Control & Ownership"]
|
|
96
102
|
C3["Payment Webhooks & Verification"]
|
|
97
103
|
C4["AI Endpoints & Cost Controls"]
|
|
98
104
|
C5["Email DNS & Configuration"]
|
|
@@ -122,11 +128,11 @@ flowchart TD
|
|
|
122
128
|
1. **Argument parsing and validation (`src/cli.ts`):**
|
|
123
129
|
Evaluates CLI flags, path arguments, targeted categories (`--only`, `--skip`), severity thresholds (`--fail-on`), output destinations (`--out`, `--sarif`), and runtime modifiers (`--ci`, `--offline`, `--history`, `--demo`).
|
|
124
130
|
2. **Project ingestion and tree traversal (`src/project.ts`):**
|
|
125
|
-
Walks the project root, automatically skipping `node_modules`, build artifacts (`dist`, `build`, `.next`), binary formats, and hidden folders (except `.github`). Ingests package manifests (`package.json`, `requirements.txt`, `pyproject.toml`), git status, and `.launchdoctorignore` patterns.
|
|
131
|
+
Walks the project root, automatically skipping `node_modules`, build artifacts (`dist`, `build`, `.next`), binary formats, and hidden folders (except `.github`). Ingests package manifests (`package.json`, `requirements.txt`, `pyproject.toml`), git status, and `.launchdoctorignore` patterns. Limits: files over 1 MB are skipped, at most 20,000 files are read, and reading stops after 128 MB of text in total; the report says when either limit is hit (`truncated` and `byteLimitReached` in `--json`).
|
|
126
132
|
3. **Stack and environment detection (`src/detect.ts`, `src/comments.ts`):**
|
|
127
133
|
Identifies frameworks (Next.js, Vite, React, Vue, Express, FastAPI, Flask, Django), server routes, database configurations (Supabase, Firebase, Prisma), payment gateways (Stripe, Razorpay), error trackers (Sentry, PostHog), and email services. Prepares a comment-stripped view of source files so commented-out code is not mistaken for active protection.
|
|
128
134
|
4. **Multi-category check execution (`src/checks/`):**
|
|
129
|
-
Runs audits across all
|
|
135
|
+
Runs audits across all 9 categories. If `--history` is enabled, an incremental git commit walker inspects the last `n` commits (default 500) for secrets that were removed from HEAD but remain exposed in commit history.
|
|
130
136
|
5. **Suppression and baseline matching (`src/baseline.ts`):**
|
|
131
137
|
Applies inline `launch-doctor-ignore <id>` comments and `.launchdoctorignore` path or id rules. If `.launchdoctor-baseline.json` is present and baseline mode is active, matches existing findings by ID, relative file path, and line content fingerprint.
|
|
132
138
|
6. **Scoring and grading engine (`src/grade.ts`):**
|
|
@@ -167,7 +173,8 @@ flowchart LR
|
|
|
167
173
|
| Category | What it catches | Severity range |
|
|
168
174
|
|---|---|---|
|
|
169
175
|
| Secrets & keys (`secrets`) | Stripe, Clerk, OpenAI, Anthropic, OpenRouter, Groq, Hugging Face, Supabase, AWS, GitHub, Slack, SendGrid, Resend, Paddle, Convex, Appwrite, and Lemon Squeezy keys in code; Supabase `service_role` keys; private keys; database URLs with passwords; secrets in `NEXT_PUBLIC_` / `VITE_` / `EXPO_PUBLIC_` variables; keys in mobile app code (they ship inside the app); `.env` files committed or not in `.gitignore`; with `--history`, keys still in git history | Warning to critical |
|
|
170
|
-
| Database & backups (`database`) | Supabase tables without Row Level Security; policies that let anyone write (`using (true)`); write policies open to any signed-in user; Firebase test-mode or open rules; Convex mutations and actions anyone can call without signing in; Appwrite permissions that let anyone (or every signed-in user) change data; SQLite on serverless hosting; `prisma db push` / `--accept-data-loss` instead of migrations | Warning to critical |
|
|
176
|
+
| Database & backups (`database`) | Supabase tables without Row Level Security; policies that let anyone write (`using (true)`); write policies open to any signed-in user; read policies that let any signed-in user read every row (`for select to authenticated using (true)`); public Supabase Storage buckets (in SQL migrations, `supabase/config.toml` or `createBucket`) whose names suggest private files, and storage policies that let signed-out visitors upload, replace or delete files; Firebase test-mode or open rules; Convex mutations and actions anyone can call without signing in; Appwrite permissions that let anyone (or every signed-in user) change data; SQLite on serverless hosting; `prisma db push` / `--accept-data-loss` instead of migrations | Warning to critical |
|
|
177
|
+
| Access control (`access`) | Next.js Server Actions and API routes (Next.js, Express, tRPC, FastAPI, Flask, Django) that change data without checking who is calling, in apps that have accounts; signed-in handlers that load or change a record by an id from the request with no owner filter, owner comparison, permission helper or admin check (an IDOR); roles or plans read from Supabase `user_metadata` or Clerk `unsafeMetadata`, which users can edit; whole request bodies saved to the database (mass assignment) and DRF serializers with `fields = "__all__"`; admin checks that only exist in browser code; JWTs decoded without verifying, or the `none` algorithm; `supabase.auth.getSession()` trusted in server code | Warning to critical |
|
|
171
178
|
| Payments (`payments`) | Stripe, Lemon Squeezy, and Paddle webhooks that don't verify the signature (each route checked separately); webhooks or global `express.json()` that parse the body before verifying, or sign re-encoded JSON; no webhook at all; Razorpay payments never verified on the server | Warning to critical |
|
|
172
179
|
| AI & API costs (`costs`) | Paid AI or SMS APIs called from the browser; `dangerouslyAllowBrowser: true`; AI endpoints with no login check (middleware only counts if it really blocks `/api`); no real rate limiter | Warning to critical |
|
|
173
180
|
| Email delivery (`email`) | Resend's test sender; personal Gmail SMTP; sender domains that don't exist; missing SPF or DMARC (live DNS check); a checklist reminder when Supabase Auth still uses its built-in test mailer | Warning |
|
|
@@ -199,7 +206,7 @@ The report uses the same grades and `--json`, `--ci`, `--fail-on`, `--out` and `
|
|
|
199
206
|
- Any critical finding caps the category at 39, which is an F.
|
|
200
207
|
- Without a critical finding the score never drops below 40, so warnings alone cannot produce an F.
|
|
201
208
|
- **Overall score** is the weighted average of the categories that ran:
|
|
202
|
-
- Weights: secrets (3), database (3), payments (3), costs (2), email (1), monitoring (1), legal (1), and first impressions (1).
|
|
209
|
+
- Weights: secrets (3), database (3), access control (3), payments (3), costs (2), email (1), monitoring (1), legal (1), and first impressions (1).
|
|
203
210
|
- Categories that do not apply, or are skipped with `--only` / `--skip`, are excluded.
|
|
204
211
|
- **Caps on the overall score:**
|
|
205
212
|
- Any critical finding anywhere caps the overall score at 39 (F).
|
|
@@ -211,9 +218,11 @@ The report uses the same grades and `--json`, `--ci`, `--fail-on`, `--out` and `
|
|
|
211
218
|
|
|
212
219
|
```
|
|
213
220
|
npx launch-doctor [folder] [options]
|
|
214
|
-
npx launch-doctor init [folder]
|
|
221
|
+
npx launch-doctor init [folder] [--hooks | --monitor]
|
|
222
|
+
npx launch-doctor grades [folder] [--json]
|
|
215
223
|
npx launch-doctor scan <url> [options]
|
|
216
224
|
npx launch-doctor mcp
|
|
225
|
+
npx launch-doctor hook <claude|cursor>
|
|
217
226
|
```
|
|
218
227
|
|
|
219
228
|
| Flag | Default | Description |
|
|
@@ -234,15 +243,23 @@ npx launch-doctor mcp
|
|
|
234
243
|
| `--history-depth <n>` | `500` | How many commits `--history` reads |
|
|
235
244
|
| `--update-baseline` | off | Save today's findings to `.launchdoctor-baseline.json` as accepted |
|
|
236
245
|
| `--no-baseline` | off | Ignore `.launchdoctor-baseline.json` and show every finding |
|
|
246
|
+
| `--record` | off | Save the grade to `.launchdoctor/grades.json` and redraw `.launchdoctor/badge.svg` (see [Grade history and badge](#grade-history-and-badge)). Not with `--changed`, `--staged`, `--only`, `--skip` or `--demo` |
|
|
247
|
+
| `--config-from <ref>` | off | Read `.launchdoctorignore` and `.launchdoctor-baseline.json` from this git ref (branch, tag or commit) instead of the folder, and ignore inline `launch-doctor-ignore` comments on lines changed since that ref. The GitHub Action passes the pull request's base commit |
|
|
248
|
+
| `--changed` | off | Only report on files changed since the last commit (edited, staged or new). Fast, for hooks. See [Hooks and fast mode](#hooks-and-fast-mode) |
|
|
249
|
+
| `--staged` | off | Only report on files staged for the next commit. For a pre-commit hook |
|
|
237
250
|
| `--demo` | off | Scan a built-in sample app full of mistakes |
|
|
238
251
|
| `-h`, `--help` | | Show help |
|
|
239
252
|
| `-v`, `--version` | | Show the version |
|
|
240
253
|
| `init [folder]` | `.` | Create `.launchdoctorignore` and `.github/workflows/launch-doctor.yml` (never overwrites) |
|
|
254
|
+
| `init --hooks` | `.` | Set up the Claude Code, Cursor and git pre-commit hooks (merges into existing files, never overwrites) |
|
|
255
|
+
| `init --monitor` | `.` | Create `.github/workflows/launch-doctor-monitor.yml`, which re-checks the project every week (see [Scheduled monitoring](#scheduled-monitoring)). Never overwrites |
|
|
256
|
+
| `grades [folder]` | `.` | Show the grades saved with `--record`, newest first (`--json` for the raw list) |
|
|
257
|
+
| `hook <claude|cursor>` | | What the Claude Code and Cursor hooks run. Reads the tool's JSON from stdin; you don't run it yourself |
|
|
241
258
|
| `scan <url>` | | Check your deployed site from the outside (see [Live site scan](#live-site-scan)) |
|
|
242
259
|
| `mcp` | | Start an MCP server so AI coding tools can run checks themselves (see [MCP server](#mcp-server)) |
|
|
243
260
|
| `--no-db` | off | With `scan`, don't test Supabase tables with the public key found in the page |
|
|
244
261
|
|
|
245
|
-
Category ids for `--only` and `--skip`: `secrets`, `database`, `payments`, `costs`, `email`, `monitoring`, `legal`, `first-impressions`. Skipped categories show as "skipped" and don't count toward the grade.
|
|
262
|
+
Category ids for `--only` and `--skip`: `secrets`, `database`, `access`, `payments`, `costs`, `email`, `monitoring`, `legal`, `first-impressions`. Skipped categories show as "skipped" and don't count toward the grade.
|
|
246
263
|
|
|
247
264
|
**Exit codes**
|
|
248
265
|
|
|
@@ -266,7 +283,7 @@ scripts/seed.ts
|
|
|
266
283
|
**/*.fixture.ts
|
|
267
284
|
```
|
|
268
285
|
|
|
269
|
-
A plain word without path characters represents a finding id. Anything containing `/`, `*`, or `.`, or matching an existing file or folder on disk, is treated as a path pattern. Finding ids that do not correspond to any known check produce a warning to catch typos.
|
|
286
|
+
A plain word without path characters represents a finding id. Anything containing `/`, `*`, or `.`, or matching an existing file or folder on disk, is treated as a path pattern. Finding ids that do not correspond to any known check produce a warning to catch typos. Only the first 1,000 entries are used; if the file has more, the report says how many were skipped (and `--json` has `ignoreLinesSkipped`). The file is read only when it is a regular file in the project, not a symlink.
|
|
270
287
|
|
|
271
288
|
### Inline ignores
|
|
272
289
|
|
|
@@ -292,6 +309,29 @@ On subsequent runs:
|
|
|
292
309
|
|
|
293
310
|
Findings are tracked by check ID, file path, and a fingerprint of the offending line, preserving baseline matches even as line numbers shift. Run with `--no-baseline` to display all suppressed findings.
|
|
294
311
|
|
|
312
|
+
### Grade history and badge
|
|
313
|
+
|
|
314
|
+
`--record` saves the grade of a full scan so you can see whether the project is getting better or worse:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
npx launch-doctor --record
|
|
318
|
+
npx launch-doctor grades # the saved grades, newest first
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
- **History:** each run adds one entry to `.launchdoctor/grades.json`: the date, grade, score, the number of critical issues, warnings and things to check yourself, the Launch Doctor version, and the commit that was scanned. Nothing else is saved (no finding text, file names or keys), and only the newest 200 entries are kept.
|
|
322
|
+
- **Comparison:** once a grade is saved, every full scan shows it under the overall grade ("Last recorded grade: B (82) on 30 Nov 2026").
|
|
323
|
+
- **Badge:** `--record` also redraws `.launchdoctor/badge.svg`. It is drawn locally, not by a badge service.
|
|
324
|
+
|
|
325
|
+
`--record` only works on a full scan of a real project: it is refused with `--changed`, `--staged`, `--only`, `--skip` and `--demo`, because their grades aren't comparable. Like other hidden folders, `.launchdoctor/` is never scanned.
|
|
326
|
+
|
|
327
|
+
**On GitHub, let [scheduled monitoring](#scheduled-monitoring) keep the history.** It stores `grades.json` and `badge.svg` on a separate `launch-doctor-grades` branch, never on your default branch, so you don't need to commit `.launchdoctor/` yourself (you can add it to `.gitignore`). Point your README badge at the file on that branch, replacing `<owner>/<repo>` with your repository (`init --monitor` prints the line with them filled in):
|
|
328
|
+
|
|
329
|
+
```markdown
|
|
330
|
+

|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
The badge shows the grade from the last monitoring run. In a private repository, `raw.githubusercontent.com` addresses need a sign-in, so the badge may not show for visitors.
|
|
334
|
+
|
|
295
335
|
## CI integration
|
|
296
336
|
|
|
297
337
|
The `npx launch-doctor init` command creates this GitHub Actions workflow:
|
|
@@ -328,6 +368,17 @@ jobs:
|
|
|
328
368
|
sarif_file: launch-doctor.sarif
|
|
329
369
|
```
|
|
330
370
|
|
|
371
|
+
### Scheduled monitoring
|
|
372
|
+
|
|
373
|
+
A project can get worse without anyone opening a pull request. `npx launch-doctor init --monitor` adds `.github/workflows/launch-doctor-monitor.yml`, which every Monday (and whenever you start it from the Actions tab):
|
|
374
|
+
|
|
375
|
+
1. reads the grade history from the `launch-doctor-grades` branch, if it exists;
|
|
376
|
+
2. scans the project with `--record --ci`, so a critical problem fails the run and GitHub emails you;
|
|
377
|
+
3. if you have set a repository variable named `LAUNCH_DOCTOR_URL` (Settings → Secrets and variables → Actions → Variables), also runs `scan` on that address;
|
|
378
|
+
4. commits the updated `grades.json` and `badge.svg` to the `launch-doctor-grades` branch, also after a failed check, so the history shows the bad weeks too.
|
|
379
|
+
|
|
380
|
+
`launch-doctor-grades` is created on the first run as an orphan branch: it shares no history with your code and holds only those two files. Nothing is ever committed to your default branch, so the monitor works when `main` is protected and doesn't add weekly commits to it. The workflow needs `contents: write` to push to the grades branch; if a branch rule (for example one matching every branch) stops the workflow's token from pushing there, the save step fails and the checks still run. The workflow runs Launch Doctor pinned to the version that created it, like the hooks (see [Hooks and fast mode](#hooks-and-fast-mode)).
|
|
381
|
+
|
|
331
382
|
### Pull request comments
|
|
332
383
|
|
|
333
384
|
The Launch Doctor GitHub Action reviews each pull request like a teammate would:
|
|
@@ -335,6 +386,7 @@ The Launch Doctor GitHub Action reviews each pull request like a teammate would:
|
|
|
335
386
|
- **Inline comments** on the lines the pull request adds, each with the plain-English risk, a fix prompt you can paste into your AI tool, and the `launch-doctor-ignore` comment that silences it.
|
|
336
387
|
- **One summary comment** with the grade, what this pull request added, what was already in the project, and the category scorecard. It is edited in place on every push, not posted again.
|
|
337
388
|
- Findings that were already commented on are not repeated, findings in `.launchdoctor-baseline.json` are left out, and each run posts at most 20 inline comments (the rest are listed in the summary).
|
|
389
|
+
- `.launchdoctorignore` and `.launchdoctor-baseline.json` are read from the base branch (with `--config-from`), not from the pull request, so a pull request can't silence its own findings by adding lines to them. An ignore or baseline change takes effect once it is merged. Inline `launch-doctor-ignore` comments on lines the pull request adds or changes are ignored too (so are all comments in files it adds); comments that were already on the base branch keep working, even if the pull request moves them down the file. To accept a finding, merge the comment (or the ignore line) first.
|
|
338
390
|
|
|
339
391
|
```yaml
|
|
340
392
|
name: Launch Doctor
|
|
@@ -347,7 +399,7 @@ jobs:
|
|
|
347
399
|
runs-on: ubuntu-latest
|
|
348
400
|
steps:
|
|
349
401
|
- uses: actions/checkout@v7
|
|
350
|
-
- uses: SHARAJ379/
|
|
402
|
+
- uses: SHARAJ379/Launch-Doctor@v0
|
|
351
403
|
```
|
|
352
404
|
|
|
353
405
|
| Input | Default | Description |
|
|
@@ -381,6 +433,42 @@ Fix the issues in LAUNCH_FIXES.md one at a time, starting with the critical ones
|
|
|
381
433
|
4. Review and accept the code edit.
|
|
382
434
|
5. Re-run `npx launch-doctor` to observe your score improve.
|
|
383
435
|
|
|
436
|
+
### Hooks and fast mode
|
|
437
|
+
|
|
438
|
+
An MCP tool only runs when the AI decides to call it. Hooks run every time, so problems are caught while the AI is still working on the file:
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
npx launch-doctor init --hooks
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
This sets up three things, merging into files you already have (it never replaces them, and a settings file that isn't valid JSON is left alone):
|
|
445
|
+
|
|
446
|
+
| Where | What it does |
|
|
447
|
+
|---|---|
|
|
448
|
+
| `.claude/settings.json` | A Claude Code `PostToolUse` hook. After Claude writes or edits a file, Launch Doctor checks that one file. If it finds a problem, Claude gets the problem and the fix prompt straight away (exit code 2), so it can fix it in the same turn. |
|
|
449
|
+
| `.cursor/hooks.json` | A Cursor `stop` hook. When the agent finishes, Launch Doctor checks the files changed since the last commit and, if it finds problems, sends them back to the agent as a follow-up message. (Cursor's `afterFileEdit` hook is not used: its documentation doesn't say that its output reaches the agent.) |
|
|
450
|
+
| `.git/hooks/pre-commit` (or wherever `core.hooksPath` points) | Checks the staged files before each commit. Only critical problems stop the commit; it prints nothing when all is well. Skip it once with `git commit --no-verify`. If the tool itself fails (for example npx can't reach npm), you see the error and the commit goes ahead. An existing shell hook keeps its content and the check is added at the top; a hook written in another language is left alone. |
|
|
451
|
+
|
|
452
|
+
The hooks run `npx --yes "launch-doctor@^X.Y.0"`, pinned to the minor version that wrote them (for example `launch-doctor@^0.4.0`), so a hook never silently starts running a newer minor or major release. npx uses your installed copy if it matches, and otherwise downloads it from npm the first time. To move to a newer version, edit the version in the hook files or delete the Launch Doctor entries and run `init --hooks` again. Everything else stays local.
|
|
453
|
+
|
|
454
|
+
**`--changed` and `--staged`** are the fast mode the hooks use. You can run them yourself too:
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
npx launch-doctor --changed # edited, staged and new files since the last commit
|
|
458
|
+
npx launch-doctor --staged --ci # what the next commit will contain; exit code 1 on critical problems
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
The whole project is still read, so checks that look across files (is there a middleware, does this route check who is calling) keep working. Then only findings *in the changed files* are reported. The email DNS lookups are skipped, `LAUNCH_FIXES.md` is not written (unless you pass `--out`), and the report says that it covers only some files. The grade is for those files, not for the project. `--changed` and `--staged` can't be combined with `--update-baseline`, `--pr-comment` or `--history`.
|
|
462
|
+
|
|
463
|
+
**What fast mode can miss compared with a full scan:**
|
|
464
|
+
- Problems with no single file: no error tracking, no privacy policy, no rate limiting, a missing `.env` entry in `.gitignore`, and the "check yourself" list.
|
|
465
|
+
- Problems that appear in a file you didn't touch because of a change elsewhere. If you delete the middleware that protected your API routes, the routes are reported as unprotected only when they are in the changed set.
|
|
466
|
+
- The Claude Code hook checks one file at a time, so it won't mention an older problem in another file.
|
|
467
|
+
- `--staged` reads the files as they are on disk. If you staged only part of a file (`git add -p`), the unstaged part is checked too.
|
|
468
|
+
- Deleted files are not checked, and files git ignores are not reported.
|
|
469
|
+
|
|
470
|
+
Run a full `npx launch-doctor` before you launch, and keep `--ci` on pull requests (see [CI integration](#ci-integration)).
|
|
471
|
+
|
|
384
472
|
### MCP server
|
|
385
473
|
|
|
386
474
|
`launch-doctor mcp` starts a [Model Context Protocol](https://modelcontextprotocol.io) server, so your AI assistant can run the checkup itself, read the findings and fix them without you copying anything.
|
|
@@ -416,24 +504,30 @@ The tools only read: nothing is written to your project, and results also come b
|
|
|
416
504
|
Launch Doctor analyzes your codebase locally on your device. Your source code, findings, and credentials are never uploaded to any remote server. Detected secrets are masked in reports (for example, `sk_live_…exe9`).
|
|
417
505
|
|
|
418
506
|
- **Email DNS validation:** This is the only network check a folder scan performs. When your project sends transactional email and a domain is identified (either discovered in code or specified via `--domain`), Launch Doctor queries your system DNS resolver for NS and TXT records (including root SPF, `send.<domain>`, `_dmarc.<domain>`, and common DKIM selectors). No code or private data is transmitted. Pass `--offline` to disable DNS lookups entirely. The `--demo` command never touches the network.
|
|
419
|
-
- **Live site scan (`scan <url>`):** sends ordinary `GET` requests to the address you give, to the JavaScript files and source maps that page loads (which may be on another domain, such as a CDN), and to your Supabase project when the page uses one. For the Supabase test it sends the public anon key it found in your page back to your own Supabase project. Nothing else is sent, and nothing is uploaded.
|
|
507
|
+
- **Live site scan (`scan <url>`):** sends ordinary `GET` requests to the address you give, to the JavaScript files and source maps that page loads (which may be on another domain, such as a CDN), and to your Supabase project when the page uses one. For the Supabase test it sends the public anon key it found in your page back to your own Supabase project. Nothing else is sent, and nothing is uploaded. When the address you give is a public site, the scan never sends a request to a private or local network address (your router, the cloud metadata address, `localhost`), even if the page or a redirect points there; you can still scan your own dev server by giving its address. Each request connects only to the address that was checked for it, so a DNS server can't switch it to a private one afterwards (DNS rebinding). See [SECURITY.md](SECURITY.md) for the details.
|
|
420
508
|
- **No telemetry:** Launch Doctor does not collect usage data or phone home.
|
|
421
509
|
- **Git history analysis (`--history`):** Runs local `git log` commands directly on your system without network requests.
|
|
422
510
|
- **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.
|
|
423
|
-
- **MCP server (`mcp`):** talks to your AI tool over stdin and stdout only; it opens no port. Its tools make the same network calls as the CLI: email DNS lookups for `scan_project` (unless `offline`), and the requests to the site you name for `scan_url
|
|
511
|
+
- **MCP server (`mcp`):** talks to your AI tool over stdin and stdout only; it opens no port. Its tools make the same network calls as the CLI: email DNS lookups for `scan_project` (unless `offline`), and the requests to the site you name for `scan_url`, which only accepts public sites.
|
|
512
|
+
- **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.
|
|
513
|
+
- **Grade history and badge (`--record`):** written to `.launchdoctor/` in your project. No badge service is involved and nothing is sent anywhere.
|
|
514
|
+
- **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.
|
|
424
515
|
- **Package installation:** standard `npx` retrieval via the npm registry.
|
|
425
516
|
|
|
426
517
|
## What it cannot do
|
|
427
518
|
|
|
428
519
|
Launch Doctor is useful because it is fast and specific. That also means it has clear blind spots. If any of these matter for your app, use another tool or a human review as well.
|
|
429
520
|
|
|
521
|
+
**Fast mode and hooks check less than a full scan**
|
|
522
|
+
- `--changed`, `--staged` and the hooks report only on the files that changed, so project-wide problems and anything caused by a change in another file are missed. See [Hooks and fast mode](#hooks-and-fast-mode) for the list. They are a safety net while you work, not a replacement for a full run before launch.
|
|
523
|
+
|
|
430
524
|
**It doesn't see your running app or your production settings**
|
|
431
525
|
- Production environment variables (Vercel, Netlify, Render and others) are invisible. A malformed URL, a wrong key or a bad model name in production will not be caught.
|
|
432
|
-
- Settings made in the Supabase, Firebase or Stripe dashboards are invisible. Tables created in the Supabase dashboard (rather than in SQL migrations in your repo) can't be checked for Row Level Security from the code, so you only get a reminder (`scan` can at least test whether they can be read on your live site).
|
|
526
|
+
- Settings made in the Supabase, Firebase or Stripe dashboards are invisible. Tables created in the Supabase dashboard (rather than in SQL migrations in your repo) can't be checked for Row Level Security from the code, so you only get a reminder (`scan` can at least test whether they can be read on your live site). The same goes for Storage buckets made public in the dashboard: you get a checklist item to review them.
|
|
433
527
|
- It doesn't run your app, call your API or read your logs (apart from the `GET` requests of `scan`), so errors that only happen at runtime are not found.
|
|
434
528
|
|
|
435
529
|
**It doesn't do a full security review**
|
|
436
|
-
-
|
|
530
|
+
- Its authorization checks (the `access` category) look for specific, common patterns, not every way access control can fail. They follow one handler at a time: a sign-in check, an owner filter or a permission check done somewhere they can't see (a shared data-access layer, a database rule set up in a dashboard, an ORM extension) is invisible to them, so they may raise a false alarm. Endpoints that are meant to be public (sign-in, webhooks, `subscribe`, `contact_submit`, `newsletter_signup`, `join_waitlist` and similar forms) are skipped by name or URL, but only when the name is the action itself: `subscribers_delete`, `contacts_export` or `feedback_admin_list`, or anything else that also says delete, update, edit, export, list, admin, remove or all, is still checked. A handler that compares the wrong ids, checks the wrong role, or writes something harmless-looking next to the real query may pass. Express handlers are only analysed when they are written inside the `app.get(...)` / `router.post(...)` call; handlers defined in another file and registered by name are not followed. Sign-in middleware added with `app.use(...)` covers only the routes registered after it in the same file; middleware registered in another file is not tracked. A sign-in helper only counts when it appears in the code (an import alone doesn't count), but a call whose result is never checked still counts. Apart from that, the access-control rules it understands are Supabase RLS in SQL files, Firebase rules files, Appwrite permissions, and whether Convex functions check who is calling.
|
|
437
531
|
- It doesn't look for XSS, SQL injection, CSRF, SSRF or similar code-level vulnerabilities.
|
|
438
532
|
- It doesn't check your dependencies for known vulnerabilities. Use `npm audit`, `pip-audit` or Dependabot for that.
|
|
439
533
|
- It is not a penetration test, and its legal-page checks are reminders, not legal advice.
|
|
@@ -451,35 +545,56 @@ Launch Doctor is useful because it is fast and specific. That also means it has
|
|
|
451
545
|
- **Basic:** Ruby, PHP and Go are scanned for hard-coded secrets and a few patterns, but their frameworks and dependency files are not understood.
|
|
452
546
|
|
|
453
547
|
**It skips some files**
|
|
454
|
-
- `node_modules`, `dist`, `build`, `out`, `coverage`, `vendor`, `venv`, `target`, `generated` and a few other build or dependency folders, and hidden folders other than `.github` (such as `.venv` and `.
|
|
548
|
+
- `node_modules`, `dist`, `build`, `out`, `coverage`, `vendor`, `venv`, `target`, `generated` and a few other build or dependency folders, and hidden folders other than `.github` (such as `.venv`, `.next` and Launch Doctor's own `.launchdoctor`).
|
|
455
549
|
- Files over 1 MB, minified `.min.js` files, source maps and binary files.
|
|
456
|
-
- Everything after the first 20,000 files (the report says when
|
|
550
|
+
- Everything after the first 20,000 files, or after 128 MB of text in total (the report says when either happens).
|
|
551
|
+
- Symlinks, FIFOs and other special files.
|
|
457
552
|
|
|
458
553
|
For apps that handle significant money or sensitive personal or health data, use Launch Doctor as a first pass and get a human security review.
|
|
459
554
|
|
|
460
555
|
## How it is tested
|
|
461
556
|
|
|
462
|
-
-
|
|
557
|
+
- 353 automated tests run on every change, on Windows, macOS and Linux, with Node.js 22 and 24.
|
|
558
|
+
- 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.
|
|
463
559
|
- 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).
|
|
464
560
|
- 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.
|
|
561
|
+
- The access-control category (new in 0.4.0) has 49 tests of its own, covering each rule and the correct patterns it must accept. It was also run on eight public open-source apps: Vercel's AI Chatbot, Taxonomy, Vercel's Next.js Subscription Payments starter, Next.js SaaS Starter, BoxyHQ SaaS Starter Kit, Documenso, the FastAPI full-stack template and OWASP Juice Shop. That turned up false alarms with six causes: admin-only FastAPI routes, admin-only tRPC procedures, a cookie mistaken for a database write, ownership checked by an earlier query in the same handler, ownership left to a helper called with the user's id, and a browser token library in a frontend it doesn't recognise. Each cause was fixed and has a regression test. What remains is one finding on a FastAPI route that has no sign-in check but is only mounted in local development, and one on Juice Shop decoding a token to show the login time; both match what the code does. It did not find Juice Shop's deliberate basket IDOR, because those handlers are registered from another file. A code review before merging found ten more problems (findings it should have raised but didn't, Python findings pointing at the wrong line, and a passed line shown for apps where nothing was checked); each is fixed and has a test.
|
|
562
|
+
- A test set of 50 public open-source apps (Next.js, AI chat apps, Vite and React, SvelteKit, Remix, Express, FastAPI, Django, Flask, Firebase and a Stripe sample) is scanned whenever a rule changes, and the results are compared with a saved snapshot, so each change shows exactly which findings it added or removed. The apps are cloned at pinned commits by `scripts/corpus.mjs` and none of their code is stored in this repository (see [CONTRIBUTING.md](CONTRIBUTING.md#testing-against-real-apps)). The first run turned up 13 causes of false alarms, such as a committed `.env` that only held placeholders being called critical, Stripe webhooks verified in Python or Ruby being called unverified, and Supabase's public local-development keys being called leaked service keys. Each was fixed and has a regression test (`test/real-app-false-alarms.test.ts`). I read every critical finding and every access-control finding on those apps; the common project-wide warnings (no error tracking, no privacy policy and similar) were only spot-checked, so some false alarms in them may remain. Many of the apps are starters and samples that are not meant to be launched as they are, so a low grade for one of them is often right.
|
|
465
563
|
- Every bug fix gets a regression test, so the same mistake doesn't come back.
|
|
466
564
|
- What hasn't happened yet is wide real-world use. Most false alarms are found when the tool meets code written differently from what it has seen, so your reports make the biggest difference.
|
|
467
565
|
|
|
468
566
|
## Found a wrong finding?
|
|
469
567
|
|
|
470
|
-
If Launch Doctor reports something that is fine, misses a real problem, or crashes, please open an issue: [report a false alarm](https://github.com/SHARAJ379/
|
|
568
|
+
If Launch Doctor reports something that is fine, misses a real problem, or crashes, please open an issue: [report a false alarm](https://github.com/SHARAJ379/Launch-Doctor/issues/new?template=false_positive.yml) or [report a bug](https://github.com/SHARAJ379/Launch-Doctor/issues/new?template=bug_report.yml). A short code snippet that reproduces it (with any keys removed) is the most helpful thing you can include. Fixes are released as small patch versions.
|
|
471
569
|
|
|
472
570
|
Meanwhile you can silence a finding with `.launchdoctorignore` or an inline `launch-doctor-ignore` comment (see [Configuration](#configuration)).
|
|
473
571
|
|
|
474
572
|
## Roadmap
|
|
475
573
|
|
|
476
|
-
|
|
574
|
+
What comes next (the 0.5.0 engine rewrite, then milestones such as coverage reporting, more rules for the mistakes AI tools make, opt-in supply-chain and production-settings checks), and what is deliberately not planned, is in [docs/roadmap.md](docs/roadmap.md). Done so far:
|
|
477
575
|
|
|
478
576
|
- [x] Live URL inspection (`launch-doctor scan <url>`: exposed `.env`, source maps, security headers, open Supabase tables via anonymous key)
|
|
479
577
|
- [x] GitHub Action that posts a summary and inline fix prompts on pull requests ([Pull request comments](#pull-request-comments))
|
|
480
578
|
- [x] Model Context Protocol (MCP) server for direct Claude Code and Cursor integration ([MCP server](#mcp-server))
|
|
481
579
|
- [x] Extended provider coverage (Clerk, Convex, Appwrite, Lemon Squeezy, Paddle)
|
|
482
580
|
- [x] Mobile framework support (Expo, React Native)
|
|
581
|
+
- [x] Grade history, a README badge and weekly monitoring ([Grade history and badge](#grade-history-and-badge), [Scheduled monitoring](#scheduled-monitoring))
|
|
582
|
+
|
|
583
|
+
## Using it as a library (experimental)
|
|
584
|
+
|
|
585
|
+
The package can also be imported. This API is **experimental**: the names and signatures below keep working through 0.5.0, and any change after that is announced in the changelog first.
|
|
586
|
+
|
|
587
|
+
```ts
|
|
588
|
+
import { runDoctor, renderReport, renderFixes } from 'launch-doctor';
|
|
589
|
+
|
|
590
|
+
const report = await runDoctor('./my-app', { offline: true });
|
|
591
|
+
console.log(report.grade, report.counts);
|
|
592
|
+
process.stdout.write(renderReport(report));
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
- `runDoctor(folder, options)` returns the same report as `--json`. The options include `offline`, `only`, `skip`, `onlyFiles`, `configFrom`, `history`, `baseline`, `maxFiles` and `maxBytes`.
|
|
596
|
+
- `renderReport(report)`, `renderFixes(report)` (the text of `LAUNCH_FIXES.md`), `renderPrComment(...)`, `postPrFeedback(...)` and `prContextFromEnv(...)` are the renderers the CLI and the GitHub Action use.
|
|
597
|
+
- `ProjectContext`, `CHECKS`, `CATEGORY_IDS()` and `isInlineIgnored()` give lower-level access, and the report types are exported too.
|
|
483
598
|
|
|
484
599
|
## Contributing
|
|
485
600
|
|
|
@@ -490,6 +605,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for local environment setup, architecture
|
|
|
490
605
|
Thanks to everyone who has helped build Launch Doctor. Contributors are listed here once their pull request is merged.
|
|
491
606
|
|
|
492
607
|
- [@SHARAJ379](https://github.com/SHARAJ379): creator and maintainer
|
|
608
|
+
- [@namaysingh3925](https://github.com/namaysingh3925): early development (many early commits were made from his machine)
|
|
493
609
|
|
|
494
610
|
Want to be on this list? Reporting a false alarm with a small example is a great first contribution, and issues labelled `good first issue` or `help wanted` are a good place to start once there are some.
|
|
495
611
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ProjectContext, SourceFile } from './project.js';
|
|
2
|
+
/**
|
|
3
|
+
* The places where a request from the outside world runs code: Next.js Server Actions and route
|
|
4
|
+
* handlers, Express-style routes, tRPC procedures, and FastAPI / Flask / Django views.
|
|
5
|
+
* The access-control check looks at each one separately.
|
|
6
|
+
*/
|
|
7
|
+
export type UnitKind = 'action' | 'route' | 'express' | 'trpc' | 'python';
|
|
8
|
+
export interface Unit {
|
|
9
|
+
kind: UnitKind;
|
|
10
|
+
file: SourceFile;
|
|
11
|
+
/** Function name, or the procedure key for tRPC. Empty when it has none. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Upper-case HTTP method; 'ANY' when it can't be told (Django views, Pages Router default exports). */
|
|
14
|
+
method: string;
|
|
15
|
+
/** URL path when known ("/api/notes/:id"). */
|
|
16
|
+
urlPath: string | null;
|
|
17
|
+
/** The parameter list, without the parentheses. */
|
|
18
|
+
params: string;
|
|
19
|
+
/** Source text of the whole function (comments blanked out). */
|
|
20
|
+
text: string;
|
|
21
|
+
/** Index of `text` in the file. */
|
|
22
|
+
start: number;
|
|
23
|
+
line: number;
|
|
24
|
+
/** True when the parameters come straight from the caller (Server Action arguments, tRPC input, Python view arguments). */
|
|
25
|
+
paramsFromCaller: boolean;
|
|
26
|
+
/** A sign-in check that sits outside the body: a wrapper, route middleware, a protected procedure, a decorator. */
|
|
27
|
+
authOutside: boolean;
|
|
28
|
+
/** Only admins can reach it (an admin wrapper, middleware, procedure or dependency), so it may touch anyone's records. */
|
|
29
|
+
adminOnly: boolean;
|
|
30
|
+
/** Code of local modules this function reaches through imports. */
|
|
31
|
+
reachedCode: string;
|
|
32
|
+
/** Code of the same file outside every unit (helpers defined next to it). */
|
|
33
|
+
shared: string;
|
|
34
|
+
}
|
|
35
|
+
/** A whole file of Server Actions: "use server" is its first statement. */
|
|
36
|
+
export declare const FILE_USE_SERVER: RegExp;
|
|
37
|
+
/**
|
|
38
|
+
* The body of a function whose parameter list opens at `paren`: skips a return type annotation
|
|
39
|
+
* (`: Promise<{ ok: boolean }>`) and an arrow. Returns [start, end) of the body, or null.
|
|
40
|
+
*/
|
|
41
|
+
export declare function bodyAfterParams(code: string, paren: number): {
|
|
42
|
+
start: number;
|
|
43
|
+
end: number;
|
|
44
|
+
} | null;
|
|
45
|
+
/** Decorators and parameters that sign the caller in. */
|
|
46
|
+
export declare const PY_AUTH_DECORATOR: RegExp;
|
|
47
|
+
/**
|
|
48
|
+
* Every request entry point in server code.
|
|
49
|
+
* `isServer` says which files run on the server; `projectPythonAuth` is true when sign-in is enforced
|
|
50
|
+
* for every Python view project-wide (Django's LoginRequiredMiddleware, a FastAPI router included with dependencies).
|
|
51
|
+
*/
|
|
52
|
+
export declare function findUnits(ctx: ProjectContext, isServer: (f: SourceFile) => boolean, isRoute: (f: SourceFile) => boolean, projectPythonAuth: boolean): Unit[];
|