launch-doctor 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -6
- package/LICENSE +1 -0
- package/README.md +95 -20
- 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 +111 -9
- 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/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/live.d.ts +9 -0
- package/dist/src/live.js +73 -22
- package/dist/src/mcp.js +7 -2
- package/dist/src/net-guard.d.ts +34 -0
- package/dist/src/net-guard.js +144 -0
- package/dist/src/project.d.ts +34 -5
- package/dist/src/project.js +145 -111
- package/dist/src/report.d.ts +2 -0
- package/dist/src/report.js +11 -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,81 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.0] - 2026-12-02
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- New category: **Access control** (`access`, weight 3). It looks for the authorization mistakes that come up most in AI-built apps:
|
|
15
|
+
- `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.
|
|
16
|
+
- `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.
|
|
17
|
+
- `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.
|
|
18
|
+
- `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.
|
|
19
|
+
- `mass-assignment`: whole request bodies, form data or Server Action arguments saved to the database, and DRF serializers or Django forms with `fields = "__all__"`.
|
|
20
|
+
- `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.
|
|
21
|
+
- `jwt-not-verified` and `jwt-none-algorithm` (critical): tokens decoded without checking the signature, or the `none` algorithm allowed.
|
|
22
|
+
- `supabase-getsession-server`: `supabase.auth.getSession()` trusted in server code without `getClaims()` or `getUser()`.
|
|
23
|
+
- Checklist: try to open another user's data with a second test account.
|
|
24
|
+
- The demo app has an admin page that is only protected in the browser.
|
|
25
|
+
- `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`).
|
|
26
|
+
- 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.
|
|
27
|
+
- `--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.
|
|
28
|
+
|
|
29
|
+
- `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.
|
|
30
|
+
- `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.
|
|
31
|
+
- `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.
|
|
32
|
+
- `--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`.
|
|
33
|
+
- `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.
|
|
34
|
+
|
|
35
|
+
### Security
|
|
36
|
+
|
|
37
|
+
- 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.
|
|
38
|
+
- `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.
|
|
39
|
+
- `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.
|
|
40
|
+
- 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.
|
|
41
|
+
- 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.
|
|
42
|
+
- 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.
|
|
43
|
+
- 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.
|
|
44
|
+
- 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.
|
|
45
|
+
- 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.
|
|
46
|
+
- 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.
|
|
47
|
+
- 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.
|
|
48
|
+
- 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.
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- 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.
|
|
53
|
+
- 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.
|
|
54
|
+
|
|
55
|
+
False alarms found by running Launch Doctor on 50 real open-source apps:
|
|
56
|
+
|
|
57
|
+
- 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`.
|
|
58
|
+
- `.example.env` (the word "example" before `env`) is a template, like `.env.example`, not a real env file.
|
|
59
|
+
- 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`).
|
|
60
|
+
- 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.
|
|
61
|
+
- 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.
|
|
62
|
+
- `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.
|
|
63
|
+
- 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.
|
|
64
|
+
- 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.
|
|
65
|
+
- 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.
|
|
66
|
+
- 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.
|
|
67
|
+
- `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.
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
|
|
71
|
+
- 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.
|
|
72
|
+
- LICENSE, README and package.json credit Namay Singh for early development.
|
|
73
|
+
|
|
74
|
+
### Fixed
|
|
75
|
+
|
|
76
|
+
- Fix: 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.
|
|
77
|
+
- 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.
|
|
78
|
+
- 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.
|
|
79
|
+
|
|
10
80
|
## [0.3.0] - 2026-11-27
|
|
11
81
|
|
|
12
82
|
### Added
|
|
13
83
|
|
|
14
|
-
- GitHub Action (`uses: SHARAJ379/
|
|
84
|
+
- 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
85
|
- `--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
86
|
- When `GITHUB_OUTPUT` is set, the grade, score, critical and warning counts are saved as step outputs.
|
|
17
87
|
- `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 +170,9 @@ First release.
|
|
|
100
170
|
- `.launchdoctorignore` for silencing findings by id or skipping paths.
|
|
101
171
|
- Support for JavaScript / TypeScript and Python projects.
|
|
102
172
|
|
|
103
|
-
[Unreleased]: https://github.com/SHARAJ379/
|
|
104
|
-
[0.
|
|
105
|
-
[0.
|
|
106
|
-
[0.2.
|
|
107
|
-
[0.
|
|
173
|
+
[Unreleased]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.4.0...HEAD
|
|
174
|
+
[0.4.0]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.3.0...v0.4.0
|
|
175
|
+
[0.3.0]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.2.1...v0.3.0
|
|
176
|
+
[0.2.1]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.2.0...v0.2.1
|
|
177
|
+
[0.2.0]: https://github.com/SHARAJ379/Launch-Doctor/compare/v0.1.0...v0.2.0
|
|
178
|
+
[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.0
|
|
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,10 @@ 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]
|
|
215
222
|
npx launch-doctor scan <url> [options]
|
|
216
223
|
npx launch-doctor mcp
|
|
224
|
+
npx launch-doctor hook <claude|cursor>
|
|
217
225
|
```
|
|
218
226
|
|
|
219
227
|
| Flag | Default | Description |
|
|
@@ -234,15 +242,20 @@ npx launch-doctor mcp
|
|
|
234
242
|
| `--history-depth <n>` | `500` | How many commits `--history` reads |
|
|
235
243
|
| `--update-baseline` | off | Save today's findings to `.launchdoctor-baseline.json` as accepted |
|
|
236
244
|
| `--no-baseline` | off | Ignore `.launchdoctor-baseline.json` and show every finding |
|
|
245
|
+
| `--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 |
|
|
246
|
+
| `--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) |
|
|
247
|
+
| `--staged` | off | Only report on files staged for the next commit. For a pre-commit hook |
|
|
237
248
|
| `--demo` | off | Scan a built-in sample app full of mistakes |
|
|
238
249
|
| `-h`, `--help` | | Show help |
|
|
239
250
|
| `-v`, `--version` | | Show the version |
|
|
240
251
|
| `init [folder]` | `.` | Create `.launchdoctorignore` and `.github/workflows/launch-doctor.yml` (never overwrites) |
|
|
252
|
+
| `init --hooks` | `.` | Set up the Claude Code, Cursor and git pre-commit hooks (merges into existing files, never overwrites) |
|
|
253
|
+
| `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
254
|
| `scan <url>` | | Check your deployed site from the outside (see [Live site scan](#live-site-scan)) |
|
|
242
255
|
| `mcp` | | Start an MCP server so AI coding tools can run checks themselves (see [MCP server](#mcp-server)) |
|
|
243
256
|
| `--no-db` | off | With `scan`, don't test Supabase tables with the public key found in the page |
|
|
244
257
|
|
|
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.
|
|
258
|
+
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
259
|
|
|
247
260
|
**Exit codes**
|
|
248
261
|
|
|
@@ -266,7 +279,7 @@ scripts/seed.ts
|
|
|
266
279
|
**/*.fixture.ts
|
|
267
280
|
```
|
|
268
281
|
|
|
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.
|
|
282
|
+
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
283
|
|
|
271
284
|
### Inline ignores
|
|
272
285
|
|
|
@@ -335,6 +348,7 @@ The Launch Doctor GitHub Action reviews each pull request like a teammate would:
|
|
|
335
348
|
- **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
349
|
- **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
350
|
- 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).
|
|
351
|
+
- `.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
352
|
|
|
339
353
|
```yaml
|
|
340
354
|
name: Launch Doctor
|
|
@@ -347,7 +361,7 @@ jobs:
|
|
|
347
361
|
runs-on: ubuntu-latest
|
|
348
362
|
steps:
|
|
349
363
|
- uses: actions/checkout@v7
|
|
350
|
-
- uses: SHARAJ379/
|
|
364
|
+
- uses: SHARAJ379/Launch-Doctor@v0
|
|
351
365
|
```
|
|
352
366
|
|
|
353
367
|
| Input | Default | Description |
|
|
@@ -381,6 +395,42 @@ Fix the issues in LAUNCH_FIXES.md one at a time, starting with the critical ones
|
|
|
381
395
|
4. Review and accept the code edit.
|
|
382
396
|
5. Re-run `npx launch-doctor` to observe your score improve.
|
|
383
397
|
|
|
398
|
+
### Hooks and fast mode
|
|
399
|
+
|
|
400
|
+
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:
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
npx launch-doctor init --hooks
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
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):
|
|
407
|
+
|
|
408
|
+
| Where | What it does |
|
|
409
|
+
|---|---|
|
|
410
|
+
| `.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. |
|
|
411
|
+
| `.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.) |
|
|
412
|
+
| `.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. |
|
|
413
|
+
|
|
414
|
+
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.
|
|
415
|
+
|
|
416
|
+
**`--changed` and `--staged`** are the fast mode the hooks use. You can run them yourself too:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
npx launch-doctor --changed # edited, staged and new files since the last commit
|
|
420
|
+
npx launch-doctor --staged --ci # what the next commit will contain; exit code 1 on critical problems
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
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`.
|
|
424
|
+
|
|
425
|
+
**What fast mode can miss compared with a full scan:**
|
|
426
|
+
- 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.
|
|
427
|
+
- 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.
|
|
428
|
+
- The Claude Code hook checks one file at a time, so it won't mention an older problem in another file.
|
|
429
|
+
- `--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.
|
|
430
|
+
- Deleted files are not checked, and files git ignores are not reported.
|
|
431
|
+
|
|
432
|
+
Run a full `npx launch-doctor` before you launch, and keep `--ci` on pull requests (see [CI integration](#ci-integration)).
|
|
433
|
+
|
|
384
434
|
### MCP server
|
|
385
435
|
|
|
386
436
|
`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 +466,28 @@ The tools only read: nothing is written to your project, and results also come b
|
|
|
416
466
|
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
467
|
|
|
418
468
|
- **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.
|
|
469
|
+
- **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. See [SECURITY.md](SECURITY.md) for the details and one known gap.
|
|
420
470
|
- **No telemetry:** Launch Doctor does not collect usage data or phone home.
|
|
421
471
|
- **Git history analysis (`--history`):** Runs local `git log` commands directly on your system without network requests.
|
|
422
472
|
- **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
|
|
473
|
+
- **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.
|
|
474
|
+
- **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.
|
|
424
475
|
- **Package installation:** standard `npx` retrieval via the npm registry.
|
|
425
476
|
|
|
426
477
|
## What it cannot do
|
|
427
478
|
|
|
428
479
|
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
480
|
|
|
481
|
+
**Fast mode and hooks check less than a full scan**
|
|
482
|
+
- `--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.
|
|
483
|
+
|
|
430
484
|
**It doesn't see your running app or your production settings**
|
|
431
485
|
- 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).
|
|
486
|
+
- 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
487
|
- 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
488
|
|
|
435
489
|
**It doesn't do a full security review**
|
|
436
|
-
-
|
|
490
|
+
- 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
491
|
- It doesn't look for XSS, SQL injection, CSRF, SSRF or similar code-level vulnerabilities.
|
|
438
492
|
- It doesn't check your dependencies for known vulnerabilities. Use `npm audit`, `pip-audit` or Dependabot for that.
|
|
439
493
|
- It is not a penetration test, and its legal-page checks are reminders, not legal advice.
|
|
@@ -453,21 +507,25 @@ Launch Doctor is useful because it is fast and specific. That also means it has
|
|
|
453
507
|
**It skips some files**
|
|
454
508
|
- `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 `.next`).
|
|
455
509
|
- 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
|
|
510
|
+
- Everything after the first 20,000 files, or after 128 MB of text in total (the report says when either happens).
|
|
511
|
+
- Symlinks, FIFOs and other special files.
|
|
457
512
|
|
|
458
513
|
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
514
|
|
|
460
515
|
## How it is tested
|
|
461
516
|
|
|
462
|
-
-
|
|
517
|
+
- 334 automated tests run on every change, on Windows, macOS and Linux, with Node.js 22 and 24.
|
|
518
|
+
- 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
519
|
- 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
520
|
- 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.
|
|
521
|
+
- 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.
|
|
522
|
+
- 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
523
|
- Every bug fix gets a regression test, so the same mistake doesn't come back.
|
|
466
524
|
- 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
525
|
|
|
468
526
|
## Found a wrong finding?
|
|
469
527
|
|
|
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/
|
|
528
|
+
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
529
|
|
|
472
530
|
Meanwhile you can silence a finding with `.launchdoctorignore` or an inline `launch-doctor-ignore` comment (see [Configuration](#configuration)).
|
|
473
531
|
|
|
@@ -481,6 +539,22 @@ Planned work, in no fixed order and without dates:
|
|
|
481
539
|
- [x] Extended provider coverage (Clerk, Convex, Appwrite, Lemon Squeezy, Paddle)
|
|
482
540
|
- [x] Mobile framework support (Expo, React Native)
|
|
483
541
|
|
|
542
|
+
## Using it as a library (experimental)
|
|
543
|
+
|
|
544
|
+
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.
|
|
545
|
+
|
|
546
|
+
```ts
|
|
547
|
+
import { runDoctor, renderReport, renderFixes } from 'launch-doctor';
|
|
548
|
+
|
|
549
|
+
const report = await runDoctor('./my-app', { offline: true });
|
|
550
|
+
console.log(report.grade, report.counts);
|
|
551
|
+
process.stdout.write(renderReport(report));
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
- `runDoctor(folder, options)` returns the same report as `--json`. The options include `offline`, `only`, `skip`, `onlyFiles`, `configFrom`, `history`, `baseline`, `maxFiles` and `maxBytes`.
|
|
555
|
+
- `renderReport(report)`, `renderFixes(report)` (the text of `LAUNCH_FIXES.md`), `renderPrComment(...)`, `postPrFeedback(...)` and `prContextFromEnv(...)` are the renderers the CLI and the GitHub Action use.
|
|
556
|
+
- `ProjectContext`, `CHECKS`, `CATEGORY_IDS()` and `isInlineIgnored()` give lower-level access, and the report types are exported too.
|
|
557
|
+
|
|
484
558
|
## Contributing
|
|
485
559
|
|
|
486
560
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for local environment setup, architecture notes, and instructions on creating new checks. All contributors are expected to adhere to the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
@@ -490,6 +564,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for local environment setup, architecture
|
|
|
490
564
|
Thanks to everyone who has helped build Launch Doctor. Contributors are listed here once their pull request is merged.
|
|
491
565
|
|
|
492
566
|
- [@SHARAJ379](https://github.com/SHARAJ379): creator and maintainer
|
|
567
|
+
- [@namaysingh3925](https://github.com/namaysingh3925): early development (many early commits were made from his machine)
|
|
493
568
|
|
|
494
569
|
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
570
|
|
|
@@ -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[];
|