deployready 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.
Files changed (106) hide show
  1. package/README.md +139 -45
  2. package/SECURITY.md +34 -0
  3. package/dist/active/httpAdapter.js +13 -6
  4. package/dist/active/httpAdapter.js.map +1 -1
  5. package/dist/active/mutationProbe.js +132 -0
  6. package/dist/active/mutationProbe.js.map +1 -0
  7. package/dist/active/runner.js +77 -7
  8. package/dist/active/runner.js.map +1 -1
  9. package/dist/active/scope.js +74 -0
  10. package/dist/active/scope.js.map +1 -0
  11. package/dist/agent/FileEditor.js +31 -3
  12. package/dist/agent/FileEditor.js.map +1 -1
  13. package/dist/agent/FixManager.js +25 -12
  14. package/dist/agent/FixManager.js.map +1 -1
  15. package/dist/agent/context.js +199 -0
  16. package/dist/agent/context.js.map +1 -0
  17. package/dist/agent/fixPrompt.js +31 -0
  18. package/dist/agent/fixPrompt.js.map +1 -0
  19. package/dist/ai/ModelRouter.js +3 -3
  20. package/dist/ai/ModelRouter.js.map +1 -1
  21. package/dist/ai/PromptBuilder.js +7 -3
  22. package/dist/ai/PromptBuilder.js.map +1 -1
  23. package/dist/analysis/SeverityScorer.js +1 -1
  24. package/dist/analysis/SeverityScorer.js.map +1 -1
  25. package/dist/analysis/VulnerabilityDetector.js +257 -35
  26. package/dist/analysis/VulnerabilityDetector.js.map +1 -1
  27. package/dist/analysis/idor.js +261 -0
  28. package/dist/analysis/idor.js.map +1 -0
  29. package/dist/analysis/rls.js +81 -15
  30. package/dist/analysis/rls.js.map +1 -1
  31. package/dist/analysis/routeAuth.js +93 -0
  32. package/dist/analysis/routeAuth.js.map +1 -0
  33. package/dist/analysis/rules.js +85 -1
  34. package/dist/analysis/rules.js.map +1 -1
  35. package/dist/cli/Commands.js +65 -3
  36. package/dist/cli/Commands.js.map +1 -1
  37. package/dist/cli/InteractiveShell.js +79 -8
  38. package/dist/cli/InteractiveShell.js.map +1 -1
  39. package/dist/core/CiGate.js +5 -0
  40. package/dist/core/CiGate.js.map +1 -1
  41. package/dist/core/Orchestrator.js +56 -9
  42. package/dist/core/Orchestrator.js.map +1 -1
  43. package/dist/core/Verifier.js +236 -18
  44. package/dist/core/Verifier.js.map +1 -1
  45. package/dist/dynamic/APIAnalyzer.js +5 -0
  46. package/dist/dynamic/APIAnalyzer.js.map +1 -1
  47. package/dist/dynamic/PerformanceTester.js +12 -0
  48. package/dist/dynamic/PerformanceTester.js.map +1 -1
  49. package/dist/dynamic/SecurityTester.js +45 -1
  50. package/dist/dynamic/SecurityTester.js.map +1 -1
  51. package/dist/dynamic/commonPaths/prober.js +9 -2
  52. package/dist/dynamic/commonPaths/prober.js.map +1 -1
  53. package/dist/dynamic/proof.js +79 -0
  54. package/dist/dynamic/proof.js.map +1 -0
  55. package/dist/firebase/conditions.js +61 -0
  56. package/dist/firebase/conditions.js.map +1 -0
  57. package/dist/firebase/index.js +31 -0
  58. package/dist/firebase/index.js.map +1 -0
  59. package/dist/firebase/rtdbParser.js +96 -0
  60. package/dist/firebase/rtdbParser.js.map +1 -0
  61. package/dist/firebase/rules.js +171 -0
  62. package/dist/firebase/rules.js.map +1 -0
  63. package/dist/firebase/rulesParser.js +193 -0
  64. package/dist/firebase/rulesParser.js.map +1 -0
  65. package/dist/firebase/static.js +179 -0
  66. package/dist/firebase/static.js.map +1 -0
  67. package/dist/mcp/analyzeFix.js +62 -0
  68. package/dist/mcp/analyzeFix.js.map +1 -0
  69. package/dist/mcp/fixes.js +69 -0
  70. package/dist/mcp/fixes.js.map +1 -0
  71. package/dist/mcp/readiness.js +21 -0
  72. package/dist/mcp/readiness.js.map +1 -0
  73. package/dist/mcp/server.js +77 -0
  74. package/dist/mcp/server.js.map +1 -0
  75. package/dist/mcp/supabase.js +65 -0
  76. package/dist/mcp/supabase.js.map +1 -0
  77. package/dist/mcp/tools.js +186 -0
  78. package/dist/mcp/tools.js.map +1 -0
  79. package/dist/supabase/guard.js +95 -0
  80. package/dist/supabase/guard.js.map +1 -0
  81. package/dist/supabase/http.js +113 -0
  82. package/dist/supabase/http.js.map +1 -0
  83. package/dist/supabase/index.js +156 -0
  84. package/dist/supabase/index.js.map +1 -0
  85. package/dist/supabase/keys.js +56 -0
  86. package/dist/supabase/keys.js.map +1 -0
  87. package/dist/supabase/live.js +397 -0
  88. package/dist/supabase/live.js.map +1 -0
  89. package/dist/supabase/static.js +213 -0
  90. package/dist/supabase/static.js.map +1 -0
  91. package/dist/ui/ExportManager.js +10 -0
  92. package/dist/ui/ExportManager.js.map +1 -1
  93. package/dist/ui/HtmlReporter.js +31 -0
  94. package/dist/ui/HtmlReporter.js.map +1 -1
  95. package/dist/ui/IssuePresenter.js +14 -0
  96. package/dist/ui/IssuePresenter.js.map +1 -1
  97. package/dist/ui/Sarif.js +101 -0
  98. package/dist/ui/Sarif.js.map +1 -0
  99. package/dist/ui/badge.js +60 -0
  100. package/dist/ui/badge.js.map +1 -0
  101. package/dist/utils/FileWalker.js +3 -0
  102. package/dist/utils/FileWalker.js.map +1 -1
  103. package/dist/utils/redact.js +2 -1
  104. package/dist/utils/redact.js.map +1 -1
  105. package/package.json +7 -3
  106. package/skills/deployready/SKILL.md +55 -0
package/README.md CHANGED
@@ -1,57 +1,80 @@
1
1
  # DeployReady
2
2
 
3
- > **AI wrote it fast. DeployReady checks if it's safe to ship.**
4
-
5
- A pre-flight check for vibe-coded apps: run 30+ structured tests across your code **and** your running app, get a 0–100 readiness score, and apply **AI-powered fixes** — all in one command. Built for people shipping with Cursor, Copilot, Claude Code, v0, or bolt — not a lecture about them.
3
+ DeployReady is a local security and production-readiness scanner for apps built with AI coding tools. It reads your code, optionally tests your app running on localhost, and gives a 0-100 readiness score with fixes.
6
4
 
7
5
  ```bash
8
- npx deployready@latest analyze ./my-app
6
+ npx deployready@latest
9
7
  ```
10
8
 
9
+ Requires Node.js 18 or later. Use `@latest` because plain `npx deployready` can reuse a cached older copy. To install globally instead: `npm install -g deployready`, then run `deployready`.
10
+
11
11
  <p align="center">
12
- <img src="docs/scan-demo.svg" alt="Terminal recording of DeployReady scanning a small AI-generated Express app and finding a SQL injection, a hardcoded AWS key, eval() code injection, and an unprotected .env file — readiness score 39/100" width="720">
12
+ <img src="docs/screenshots/report.png" alt="DeployReady HTML report for the bundled sample app: readiness score 38/100, 4 critical and 3 warning findings" width="720">
13
13
  </p>
14
14
 
15
- <p align="center"><sub>Unedited output from a real scan of a small AI-generated app — see <a href="tests/sample-app"><code>tests/sample-app</code></a>.</sub></p>
15
+ <p align="center"><sub>HTML report (<code>--html</code>) for the deliberately vulnerable <a href="tests/sample-app"><code>tests/sample-app</code></a>.</sub></p>
16
16
 
17
- > _Privacy:_ scanning runs locally. Only a redacted findings report is ever sent to an AI — after you approve it, never your source code — and you can use a local model (Ollama) to keep everything 100% offline.
17
+ ## Quick start (about 60 seconds)
18
18
 
19
- ## Install
19
+ ```bash
20
+ # 1. Scan. Static only, fully offline:
21
+ npx deployready@latest analyze ./my-app --no-ai --no-dynamic
20
22
 
21
- **Run without installing** (recommended — always works, nothing to set up):
23
+ # 2. Apply the safe, deterministic fixes (backups are written first):
24
+ npx deployready@latest analyze ./my-app --no-ai --no-dynamic --fix
25
+ # in the interactive session the same thing is: fix --all
22
26
 
23
- ```bash
24
- npx deployready@latest ./my-app
27
+ # 3. Let your coding agent scan, fix and verify in a loop (Claude Code):
28
+ claude mcp add deployready -- npx -y deployready@latest mcp
25
29
  ```
26
30
 
27
- **Or install globally** if you run it often (faster, but you must update it yourself):
31
+ Run `npx deployready@latest` with no arguments to open the guided interactive session instead.
28
32
 
29
- ```bash
30
- npm install -g deployready
31
- deployready ./my-app
32
- # update later with: npm i -g deployready@latest
33
- ```
33
+ <p align="center">
34
+ <img src="docs/scan-demo.svg" alt="Animated terminal recording of DeployReady 0.4.0 scanning a deliberately vulnerable Flask app: 3 critical and 1 warning (score 48/100), analyze --fix applies 2 safe fixes (score 60/100), then a fix prompt for the hardcoded SECRET_KEY is printed" width="720">
35
+ </p>
36
+
37
+ <p align="center"><sub>A real run on <a href="benchmark/corpus/vibe/flask-debug-sqli-tp"><code>benchmark/corpus/vibe/flask-debug-sqli-tp</code></a> (paths shortened, repeated lines elided). Only the two findings with a safe deterministic fix are changed; the rest are left for you or your coding agent.</sub></p>
38
+
39
+ ## What it checks, and what it doesn't
40
+
41
+ **Checks**
42
+
43
+ - Static analysis of JavaScript/TypeScript and Python: hardcoded secrets, `eval`, command and SQL injection, XSS sinks, weak crypto, disabled TLS verification, insecure cookies, JWT `none`, unsafe deserialization, committed `.env`. Findings map to OWASP Top 10 (2025) and CWE.
44
+ - Access control patterns: routes without an auth check, Supabase tables without Row-Level Security, `service_role` keys in client code.
45
+ - Live checks against your app on localhost: auth bypass, exposed admin routes, secrets in responses, CORS, security headers, rate limiting.
46
+ - Opt-in active (authenticated) tests and Supabase checks, described below.
47
+ - Firebase security rules (static only): open or test-mode Firestore/Storage/Realtime Database rules, sign-in-only rules on user-owned paths, and committed service account keys. See [`docs/FIREBASE.md`](docs/FIREBASE.md).
48
+
49
+ **Does not**
34
50
 
35
- Requires Node.js >= 18. The `@latest` tag ensures you always get the newest version — plain `npx deployready` can reuse a cached older copy. Every command below is shown with `npx deployready@latest`; if you installed globally, use `deployready` instead.
51
+ - It is not a penetration test or a substitute for a code review. A score of 100 means none of these checks fired, not that the app is secure.
52
+ - Static analysis has false positives and false negatives. Business-logic flaws, most authorization design errors, and anything in languages other than JS/TS/Python are out of reach.
53
+ - Live tests only cover routes your code or OpenAPI file defines, plus links your running app advertises. Paths are not guessed unless you opt in to the common-path probe.
54
+ - AI-generated findings are marked unverified and never change the score or the CI gate.
55
+ - Supabase checks are read-only, so write exposure (INSERT/UPDATE/DELETE policies) is not tested.
56
+ - Firebase checks read the rules files in your repo only. They do not connect to Firebase, so deployed rules and Auth settings are not verified. The public web config `apiKey` is not flagged.
36
57
 
37
- ## Quick start
58
+ Test coverage numbers are in [`docs/COVERAGE.md`](docs/COVERAGE.md).
38
59
 
39
- Run it inside your project to open an interactive, guided session — no commands to memorize, just pick a number:
60
+ ## Score badge
40
61
 
41
62
  ```bash
42
- npx deployready@latest ./my-app # or just: npx deployready@latest
63
+ npx deployready@latest badge . # prints a markdown badge
64
+ npx deployready@latest badge . --write-svg badge.svg # also writes a local SVG, no network
43
65
  ```
44
66
 
45
- ```
46
- What would you like to do?
47
- 1 Scan this project now (recommended)
48
- 2 Set up or change the AI model
49
- 3 How does DeployReady work?
50
- 4 Go to the command prompt
51
- 5 Exit
67
+ The command runs a static scan and prints, for example:
68
+
69
+ ```markdown
70
+ ![DeployReady score](https://img.shields.io/badge/DeployReady-87%2F100-green)
52
71
  ```
53
72
 
54
- After each action it suggests your next step (e.g. “type `fix 1` to fix the top issue”). Type `menu` anytime to bring the guide back.
73
+ Colors: 90-100 bright green, 75-89 green, 60-74 yellow, 40-59 orange, below 40 red. The badge is a snapshot; regenerate it when the score changes.
74
+
75
+ ## Install
76
+
77
+ See the top of this page. Every command here is written as `npx deployready@latest ...`; with a global install, use `deployready ...`.
55
78
 
56
79
  ## Interactive commands
57
80
 
@@ -73,6 +96,7 @@ deployready › exit
73
96
  | `scan` · `parse` · `dynamic` · `ai` | run the whole pipeline, or one step at a time |
74
97
  | `issues [crit\|warn\|info]` · `show <n>` | list findings (optionally filtered) · show one in detail |
75
98
  | `fix <n>` | deterministic auto-fix where safe (weak hashes, disabled TLS verification, `yaml.load`, `verify=False`, Flask `debug=True`, gitignore `.env`); otherwise an AI-proposed diff you approve (creates a backup); otherwise guidance |
99
+ | `fix --all` | apply every safe deterministic fix above in one go: one confirmation, a backup per change, each one re-verified. AI-proposed fixes are never run in bulk |
76
100
  | `verify <n>` | re-run the relevant checks to confirm a fix actually resolved the issue |
77
101
  | `done <n>` · `ignore <n>` | mark fixed / ignored — the score recomputes immediately |
78
102
  | `score` · `status` | show the current readiness score / session state |
@@ -87,6 +111,7 @@ npx deployready@latest init # first-time setup (pic
87
111
  npx deployready@latest analyze ./my-app # single non-interactive scan, prints results
88
112
  npx deployready@latest analyze . --no-ai --no-dynamic # static only, fully offline
89
113
  npx deployready@latest report ./my-app # scan and export the markdown report
114
+ npx deployready@latest badge ./my-app # print a markdown score badge
90
115
  npx deployready@latest config # show the active config (secrets never printed)
91
116
  ```
92
117
 
@@ -95,6 +120,7 @@ npx deployready@latest config # show the active confi
95
120
  | Flag | Effect |
96
121
  |---|---|
97
122
  | `-y, --yes` | auto-approve all prompts (non-interactive) |
123
+ | `--fix` | apply the safe deterministic fixes (backed up), re-scan, and report the new score; works with `--json` and `--fail-on` (asks once unless `--yes`/`--json`) |
98
124
  | `--no-dynamic` | skip live localhost testing |
99
125
  | `--no-ai` | skip AI analysis (local results only) |
100
126
  | `--aggressive` | enable aggressive tests (rate-limit burst) |
@@ -104,9 +130,11 @@ npx deployready@latest config # show the active confi
104
130
  | `--fail-on <severity>` | exit non-zero if findings at/above `critical \| warning \| info \| none` exist |
105
131
  | `--baseline <file>` | gate only on findings **not** in the baseline file (existing issues are grandfathered) |
106
132
  | `--write-baseline <file>` | write the current findings to a baseline file and exit `0` (accept current state) |
107
- | `--active` | run **active** authenticated authorization tests (needs `--token`; consented, loopback-only, GET-only) |
133
+ | `--active` | run **active** authenticated authorization tests (needs `--token`; consented, loopback-only unless `--i-own-this-target`) |
108
134
  | `--token <jwt>` | bearer JWT for the active scan (your logged-in test user) |
109
135
  | `--token-b <jwt>` | a second user's JWT — enables tenant / IDOR isolation tests |
136
+ | `--active-url <url>` | base URL for the active scan (default: the app found on localhost) |
137
+ | `--i-own-this-target <host>` | confirm you own a non-loopback host so active probes may target it (repeatable, exact host) |
110
138
  | `-v, --verbose` | verbose debug output |
111
139
 
112
140
  **CI gate:** exit codes are `0` (clean), `2` (gate failed), `1` (tool error).
@@ -124,7 +152,79 @@ npx deployready@latest analyze . --no-ai --no-dynamic --write-baseline .deployre
124
152
  npx deployready@latest analyze . --no-ai --no-dynamic --baseline .deployready-baseline.json --fail-on warning # in CI
125
153
  ```
126
154
 
127
- A ready-to-copy GitHub Action is in [`docs/github-action-example.yml`](docs/github-action-example.yml).
155
+ **GitHub Action:** gate pull requests, get a sticky PR comment and code-scanning alerts (SARIF) with one step. Needs `security-events: write` and `pull-requests: write`:
156
+
157
+ ```yaml
158
+ permissions: { contents: read, security-events: write, pull-requests: write }
159
+ steps:
160
+ - uses: actions/checkout@v4
161
+ - uses: BelsoftSolutions/deployready@v0.4.0
162
+ with: { fail-on: critical }
163
+ ```
164
+
165
+ Details in [`docs/GITHUB-ACTION.md`](docs/GITHUB-ACTION.md); a full example is in [`docs/github-action-example.yml`](docs/github-action-example.yml). Locally, `--sarif <file>` writes a SARIF 2.1.0 report.
166
+
167
+ ### Fix in one command (`--fix`)
168
+
169
+ ```bash
170
+ npx deployready@latest analyze . --no-ai --no-dynamic --fix --yes # apply safe fixes, re-scan, print the new score
171
+ npx deployready@latest analyze . --no-ai --no-dynamic --fix --json --fail-on critical
172
+ ```
173
+
174
+ `--fix` only applies deterministic fixes (for example adding `.env` to `.gitignore`, or swapping a weak hash for SHA-256). Every change is backed up first. With `--json`, the report gains a `fix` block (`applied`, `skipped`, `scoreBefore`, `scoreAfter`) and `--fail-on` gates on the post-fix result.
175
+
176
+ ## Use it from your coding agent (MCP)
177
+
178
+ `deployready mcp` is a local stdio [MCP](https://modelcontextprotocol.io) server. Your own coding agent (Claude Code, Cursor, Codex, Windsurf) scans, fixes, and has DeployReady verify, in a loop. Nothing leaves your machine, and the server never calls an AI model itself.
179
+
180
+ | Tool | What it does |
181
+ |---|---|
182
+ | `scan(path?, dynamic?)` | findings (id, rule, severity, file, line, evidence, proof) plus the score |
183
+ | `get_finding(id)` | full detail, fix guidance (recommendation, OWASP, CWE) and the whole file with the line marked |
184
+ | `apply_safe_fixes(path?)` | runs the deterministic fixes; returns applied/skipped with backup paths |
185
+ | `verify(id)` | re-checks one finding: `fixed`, `still-present` or `inconclusive`, with the reason |
186
+ | `score(path?)` | re-scans; score plus a ready/not-ready verdict (ready = no open critical findings) |
187
+ | `supabase_check(path?, live?, crossUser?)` | Supabase checks; live checks only for a local or proven-owned project, credentials from env only (see docs/SUPABASE.md) |
188
+
189
+ The loop: `scan` -> `apply_safe_fixes` -> fix the rest with the agent's own edits (using `get_finding`) -> `verify` each -> `score`.
190
+
191
+ **Claude Code**
192
+
193
+ ```bash
194
+ claude mcp add deployready -- npx -y deployready@latest mcp
195
+ ```
196
+
197
+ **Live and active findings need test tokens.** `scan(dynamic: true)` and `verify` for live findings (including the token-based IDOR / JWT / escalation checks) read the test identities from the MCP server's environment: `DEPLOYREADY_TOKEN` (and `DEPLOYREADY_TOKEN_B` for the second identity). The tools accept no secrets as arguments, and tokens are never logged or echoed (proofs show `$TOKEN` placeholders). Without them, active findings stay `inconclusive`.
198
+
199
+ ```bash
200
+ claude mcp add deployready -e DEPLOYREADY_TOKEN=<test-user-jwt> -e DEPLOYREADY_TOKEN_B=<second-user-jwt> -- npx -y deployready@latest mcp
201
+ ```
202
+
203
+ The interactive shell's `verify` reads the same two variables.
204
+
205
+ A ready-made Claude Code skill that teaches the loop is in [`skills/deployready/SKILL.md`](skills/deployready/SKILL.md) (copy it to `.claude/skills/deployready/`).
206
+
207
+ **Cursor** (`.cursor/mcp.json`)
208
+
209
+ ```json
210
+ {
211
+ "mcpServers": {
212
+ "deployready": { "command": "npx", "args": ["-y", "deployready@latest", "mcp"] }
213
+ }
214
+ }
215
+ ```
216
+
217
+ **Any other MCP client** (Codex, Windsurf, ...): add the same server to its `mcpServers` config.
218
+
219
+ ```json
220
+ {
221
+ "mcpServers": {
222
+ "deployready": { "command": "npx", "args": ["-y", "deployready@latest", "mcp", "/path/to/project"] }
223
+ }
224
+ }
225
+ ```
226
+
227
+ The optional trailing path sets the default project for tool calls (default: the current directory).
128
228
 
129
229
  ### Active (authenticated) testing — "try to hack it"
130
230
 
@@ -138,8 +238,13 @@ npx deployready@latest analyze . --active --token "<your-JWT>" --token-b "<secon
138
238
  - **Broken tenant isolation** — swaps `org_id`/tenant to reach another tenant's data.
139
239
  - **Privilege escalation** — forges a `role: admin` claim and checks whether a forbidden route opens up.
140
240
  - **JWT not verified** — checks whether the server accepts a forged `alg:none` token.
241
+ - **Unauthenticated write routes** — sends each discovered `DELETE`/`PATCH` route once with **no credentials**, aimed at a record id that cannot exist (`__deployready_probe_<random>__`), with no body. A `2xx` (when a random-path control does not also answer `2xx`) means the route handles writes for anonymous callers; `401`/`403` means auth is enforced; anything else is not reported.
242
+
243
+ It is **opt-in and consented** and **loopback-only**. The tampering checks are GET-only. The write-route probe never addresses real data: it only probes routes whose every path parameter can be filled with a non-existent id, skips routes without a parameter (e.g. `DELETE /api/session`), skips `PUT` (often an upsert, so it could create data), and never runs on a non-loopback host. Need a token? Run `--active` without one and DeployReady prints step-by-step instructions for grabbing your JWT from the browser.
141
244
 
142
- It is **opt-in and consented**, **loopback-only**, and **GET-only** (it never writes). Need a token? Run `--active` without one and DeployReady prints step-by-step instructions for grabbing your JWT from the browser.
245
+ Every live finding carries **proof**: a copy-pasteable `curl` command (your tokens appear only as `$TOKEN` / `$TOKEN_B`), the status, a truncated response and the control request that shows the endpoint otherwise works, all redacted. It appears in `show`, the terminal report, the markdown/HTML reports and `--json`. `verify` reports `fixed` only with proof (the attack fails **and** a control request still works); otherwise it says `inconclusive` and why.
246
+
247
+ To run active probes against a host you own that is not on your machine (e.g. staging), name it explicitly: `--active-url https://staging.example.com --i-own-this-target staging.example.com` (repeatable; or `"ownedTargets": ["staging.example.com"]` in your config). Only that exact host is allowed — no wildcards or subdomains — and the write-route probe still stays loopback-only.
143
248
 
144
249
  ### Route discovery (on by default, nothing guessed)
145
250
 
@@ -151,17 +256,6 @@ It is **opt-in and consented**, **loopback-only**, and **GET-only** (it never wr
151
256
 
152
257
  By default the live tests never guess paths. With `--probe-common-paths` (or `"probeCommonPaths": true` in your config, interactive runs only) DeployReady also requests a fixed list of 16 well-known paths such as `/.env` and `/.git/config` from your local app, at most 20 GET requests, after showing you the list and asking first. A path is reported only when its content proves it (a `200` alone is never enough), and findings are labelled as guessed, lower confidence, in their own report section. In `--yes`, `--json` and CI only the explicit flag enables it. Details: [`docs/COMMON-PATH-PROBE.md`](docs/COMMON-PATH-PROBE.md).
153
258
 
154
- ## What it checks
155
-
156
- - **Static analysis** — Babel-based AST parsing (pure JS, no native build) for JavaScript/TypeScript, plus Python. Dependency graph, route-mount resolution across files, and stack detection (Express, Next.js, Fastify, NestJS, Koa, FastAPI, Flask, Django, Laravel).
157
- - **Secrets & vulnerabilities** — hardcoded credentials, `eval`/command/SQL injection, XSS sinks, weak crypto, insecure randomness, disabled TLS verification, JWT `none` algorithm, insecure cookies, unsafe deserialization, insecure temp files, committed `.env`, log injection — each mapped to **OWASP Top 10 (2025)** and **CWE**.
158
- - **Access control & transport** — Row-Level Security disabled or never enabled on a table, Supabase `service_role` key used in app code (RLS bypass), and insecure cleartext `http://` endpoints.
159
- - **Live dynamic testing** — finds a local server listening on a common port and, for the routes your code defines (never guessed paths), checks for auth bypass, exposed admin routes, secrets in responses, wildcard CORS, missing security headers, missing rate limiting, slow endpoints, missing cache headers, and version/stack-trace leaks.
160
- - **Active authorization testing** (opt-in, `--active`) — acts as a logged-in user to find broken object-level auth (IDOR/BOLA), broken tenant isolation, privilege escalation (forged `role`), and unverified JWTs (`alg:none`).
161
- - **Readiness score (0–100)** with a critical / warning / info breakdown.
162
- - **Deployment recommendation** — suggests where to host based on your stack, size, and whether you're frontend / backend / full-stack, flags when to split frontend and backend across platforms, and marks suitable free tiers.
163
- - **Reports** — terminal output, markdown export, and a branded HTML dashboard.
164
-
165
259
  ## How it works
166
260
 
167
261
  ```
@@ -190,14 +284,14 @@ Choose these in `init` (or in the interactive menu under "Set up or change the A
190
284
  - **Login status** is read from the CLI itself (`claude auth status`, `codex login status`). If the CLI is installed but not logged in, DeployReady offers to run the CLI's own login command (`claude auth login` / `codex login`) in your terminal. You sign in inside that tool: DeployReady never sees, reads, copies or stores your token or the CLI's auth files.
191
285
  - **Your plan's rules apply, not the API terms.** Data is handled under the data policy of your own plan and counts against your plan's usage allowance. The consent prompt says so before anything is sent.
192
286
  - **Same data as the API providers:** only the redacted structured findings report (or, for `fix`, one redacted snippet you confirm first). Never your source files.
193
- - **Text in, text out.** The CLI is started with its tools disabled, from an empty temporary folder, with a minimal environment, and its answer is treated as untrusted text. It is never asked to edit your files. When you accept a fix, DeployReady applies it with its own editor: a backup (`<file>.bak.<timestamp>`) is written first, the path is confined to your project and the result is syntax-checked.
287
+ - **Text in, text out.** The CLI is started with its tools disabled, from an empty temporary folder, with a minimal environment, and its answer is treated as untrusted text. It is never asked to edit your files. When you accept a fix, DeployReady applies it with its own editor: a backup is written to `.deployready/backups/` first, the path is confined to your project and the result is syntax-checked.
194
288
  - AI findings stay marked unverified and never change your score or the CI gate.
195
289
  - **Codex can be switched off.** To disable the Codex provider, set `"codexEnabled": false` in `~/.deployready/config.json`; it then refuses to run and sends nothing. The Claude provider has no such switch.
196
290
  - These providers are meant for interactive, local use. Each call uses your own plan allowance.
197
291
 
198
292
  ## Security & privacy
199
293
 
200
- DeployReady reads your code, probes your ports, and holds your keys — so it's built to a high bar:
294
+ To report a vulnerability in DeployReady itself, see [SECURITY.md](SECURITY.md). DeployReady reads your code, probes your ports and can hold API keys, so:
201
295
 
202
296
  - API keys are read from environment variables first and **never logged**; the on-disk config is written with `0600` permissions.
203
297
  - All terminal output and any AI payload pass through a central **secret redactor**.
package/SECURITY.md ADDED
@@ -0,0 +1,34 @@
1
+ # Security policy
2
+
3
+ ## Reporting a vulnerability in DeployReady
4
+
5
+ Please report security issues privately, not in public issues.
6
+
7
+ Use GitHub private vulnerability reporting: open the repository's **Security** tab, choose **Report a vulnerability** (or go to <https://github.com/BelsoftSolutions/deployready/security/advisories/new>). If you cannot use GitHub, open a public issue that says only that you need a private contact channel, without details.
8
+
9
+ <!-- TODO(maintainers): add a security contact email here if one is set up. -->
10
+
11
+ Include the version (`deployready --version`), what you did, and what you expected. Reports about the tool itself are in scope: for example secret leakage in output or AI payloads, scanning or probing outside the intended target, path traversal out of the project root, or unsafe handling of AI/CLI provider output. Findings that DeployReady reports about *your* project are not vulnerabilities in DeployReady.
12
+
13
+ ## Supported versions
14
+
15
+ | Version | Supported |
16
+ |---|---|
17
+ | 0.4.x | yes |
18
+ | < 0.4 | no, please upgrade |
19
+
20
+ ## What leaves your machine
21
+
22
+ - Scanning, scoring, reports, fixes and the MCP server run locally. The MCP server never calls an AI model itself.
23
+ - AI analysis is optional and off with `--no-ai`. When enabled and after you approve, only a redacted, structured findings report is sent to the provider you chose (Claude API, OpenAI API, or your own `claude`/`codex` CLI login). For `fix`, one redacted snippet that you confirm first may be sent. Source files are not sent. With Ollama, nothing leaves your machine.
24
+ - Live checks only contact the target you point them at (see below). Supabase live checks contact your Supabase project, and, with an access token, `api.supabase.com` to prove ownership.
25
+ - API keys are read from environment variables first and are not logged; the on-disk config (`~/.deployready/config.json`) is written with `0600` permissions. All terminal output and AI payloads pass through a secret redactor, which is pattern-based and not a guarantee.
26
+
27
+ ## Safety model of live tests
28
+
29
+ - **Dynamic tests** target a server on loopback and are GET-only by default. Only routes your code or OpenAPI file defines (plus a bounded set of links your app advertises) are requested; aggressive tests need explicit consent.
30
+ - **Active tests** (`--active`) need your token and run against loopback. A non-loopback host is allowed only if you name that exact host with `--i-own-this-target` (no wildcards or subdomains). The tampering checks are GET-only. The unauthenticated write-route probe stays loopback-only, targets ids that cannot exist, skips `PUT`, and sends no body.
31
+ - **Supabase tests** (`--supabase`) are read-only: no insert, update or delete is ever sent, and no RPC function is invoked. Against a hosted project they run only after you prove ownership with the service-role key or an access token; a loopback URL (`supabase start`) needs no proof. Details: [docs/SUPABASE.md](docs/SUPABASE.md).
32
+ - **Common-path probe** is opt-in, at most 20 GET requests to a printed fixed list.
33
+
34
+ Only run active or Supabase tests against systems you own or are authorized to test.
@@ -8,8 +8,10 @@ exports.createActiveHttpAdapter = createActiveHttpAdapter;
8
8
  /**
9
9
  * The real network transport for the active scan (Phase 5a) — the ONE place that
10
10
  * actually sends requests, so it carries the safety rails:
11
- * - loopback-only target (SSRF/scope guard, same bar as the dynamic suite),
12
- * re-checked on every derived URL so a request can never leave the host;
11
+ * - loopback-only target by default (SSRF/scope guard, same bar as the
12
+ * dynamic suite); a non-loopback host only when the user explicitly confirmed
13
+ * they own it (`ownedHosts`), re-checked on every derived URL so a request
14
+ * can never leave the host;
13
15
  * - dry-run that sends nothing;
14
16
  * - hard timeout, no redirects, response-size cap.
15
17
  *
@@ -17,7 +19,7 @@ exports.createActiveHttpAdapter = createActiveHttpAdapter;
17
19
  * budget live above this (Orchestrator + runner).
18
20
  */
19
21
  const axios_1 = __importDefault(require("axios"));
20
- const httpClient_1 = require("../dynamic/httpClient");
22
+ const scope_1 = require("./scope");
21
23
  const TIMEOUT_MS = 8000;
22
24
  const MAX_BODY = 5 * 1024 * 1024;
23
25
  /** Build an absolute URL from base + path (+ query). Pure. */
@@ -30,11 +32,16 @@ function buildUrl(baseUrl, path, query) {
30
32
  return url.toString();
31
33
  }
32
34
  function createActiveHttpAdapter(opts) {
33
- (0, httpClient_1.assertLoopback)(opts.baseUrl); // scope is fixed to this loopback host
35
+ const owned = opts.ownedHosts ?? [];
36
+ const base = (0, scope_1.assertActiveTarget)(opts.baseUrl, owned); // scope is fixed to this host
34
37
  const timeout = opts.timeoutMs ?? TIMEOUT_MS;
35
38
  return async (req) => {
36
39
  const url = buildUrl(opts.baseUrl, req.path, req.query);
37
- (0, httpClient_1.assertLoopback)(url); // defense in depth: never leave the loopback host
40
+ // Defense in depth: never leave the base host, even if a path is absolute.
41
+ const target = (0, scope_1.assertActiveTarget)(url, owned);
42
+ if (target.host !== base.host) {
43
+ throw new Error(`Refusing to send an active probe to ${target.host}: outside the scan target ${base.host}.`);
44
+ }
38
45
  if (opts.dryRun)
39
46
  return { status: 0, bodyText: '' };
40
47
  const res = await axios_1.default.request({
@@ -48,7 +55,7 @@ function createActiveHttpAdapter(opts) {
48
55
  maxContentLength: MAX_BODY,
49
56
  });
50
57
  const bodyText = typeof res.data === 'string' ? res.data : JSON.stringify(res.data ?? '');
51
- return { status: res.status, bodyText };
58
+ return { status: res.status, bodyText, url };
52
59
  };
53
60
  }
54
61
  //# sourceMappingURL=httpAdapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"httpAdapter.js","sourceRoot":"","sources":["../../src/active/httpAdapter.ts"],"names":[],"mappings":";;;;;AAmBA,4BAMC;AASD,0DAuBC;AAzDD;;;;;;;;;;GAUG;AACH,kDAA0B;AAC1B,sDAAuD;AAGvD,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjC,8DAA8D;AAC9D,SAAgB,QAAQ,CAAC,OAAe,EAAE,IAAY,EAAE,KAAuC;IAC7F,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnC,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC;AASD,SAAgB,uBAAuB,CAAC,IAA0B;IAChE,IAAA,2BAAc,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,uCAAuC;IACrE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC;IAE7C,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE;QACnB,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACxD,IAAA,2BAAc,EAAC,GAAG,CAAC,CAAC,CAAC,kDAAkD;QAEvE,IAAI,IAAI,CAAC,MA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,EAAE,CAAC,IAAI;YAC1B,gBAAgB,EAAE,QAAQ;SAC3B,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QAC1F,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;IAC/C,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MUTATION_RULE = void 0;
4
+ exports.probeValue = probeValue;
5
+ exports.planMutationProbes = planMutationProbes;
6
+ exports.runMutationProbes = runMutationProbes;
7
+ /**
8
+ * Unauthenticated-mutation probe: does a discovered DELETE / PATCH route accept
9
+ * a request with NO credentials?
10
+ *
11
+ * Safety design (it never touches real data):
12
+ * - Only runs inside the consented active scan, and only against a loopback
13
+ * target (never an owned remote host, even with --i-own-this-target).
14
+ * - Only routes with at least one path parameter are probed, and EVERY
15
+ * parameter is filled with a value that cannot exist
16
+ * (`__deployready_probe_<random>__`), so the request addresses no real
17
+ * record. Routes without a parameter (e.g. `DELETE /api/session`) would act
18
+ * on real state and are skipped.
19
+ * - No request body is sent.
20
+ * - PUT is skipped: many APIs treat PUT as an upsert, so even a non-existent id
21
+ * could create a record.
22
+ *
23
+ * Verdict, per route:
24
+ * - 401 / 403 → authentication is enforced: nothing reported.
25
+ * - 2xx → the server handled a write for an anonymous caller. Reported,
26
+ * unless a control request (same method, random non-existent
27
+ * path) also answers 2xx — then it's a catch-all and proves nothing.
28
+ * - anything else (404, 405, 5xx, no response) → inconclusive, not reported:
29
+ * a 404 may simply mean the lookup ran before the auth check.
30
+ */
31
+ const crypto_1 = require("crypto");
32
+ const finding_1 = require("../utils/finding");
33
+ const proof_1 = require("../dynamic/proof");
34
+ exports.MUTATION_RULE = 'unauthenticated-mutation';
35
+ const PROBED_METHODS = new Set(['DELETE', 'PATCH']);
36
+ const PARAM_RE = /^(?::([A-Za-z0-9_]+)\??|\{([^{}/]+)\})$/;
37
+ const PATTERN_SEGMENT = /[:{}<>*()?+[\]\\]/;
38
+ /** Build the probe value. Exported for tests. */
39
+ function probeValue() {
40
+ return `__deployready_probe_${(0, crypto_1.randomBytes)(4).toString('hex')}__`;
41
+ }
42
+ function planMutationProbes(routes, value = probeValue()) {
43
+ const targets = [];
44
+ const skipped = [];
45
+ const seen = new Set();
46
+ for (const r of routes) {
47
+ const method = r.method.toUpperCase();
48
+ if (method === 'PUT') {
49
+ skipped.push({ method, path: r.path, reason: 'PUT may upsert, so even a non-existent id could create data' });
50
+ continue;
51
+ }
52
+ if (!PROBED_METHODS.has(method))
53
+ continue;
54
+ const key = `${method} ${r.path}`;
55
+ if (seen.has(key))
56
+ continue;
57
+ seen.add(key);
58
+ let params = 0;
59
+ let bad = false;
60
+ const out = r.path.split('/').map((seg) => {
61
+ if (PARAM_RE.test(seg)) {
62
+ params++;
63
+ return value;
64
+ }
65
+ if (PATTERN_SEGMENT.test(seg))
66
+ bad = true;
67
+ return seg;
68
+ });
69
+ if (bad || !r.path.startsWith('/')) {
70
+ skipped.push({ method, path: r.path, reason: 'path is a pattern, not a concrete route' });
71
+ }
72
+ else if (params === 0) {
73
+ skipped.push({ method, path: r.path, reason: 'no path parameter to point at a non-existent record, so a request could change real data' });
74
+ }
75
+ else {
76
+ targets.push({ method, route: r.path, path: out.join('/') });
77
+ }
78
+ }
79
+ return { targets, skipped };
80
+ }
81
+ function is2xx(s) {
82
+ return s !== undefined && s >= 200 && s < 300;
83
+ }
84
+ async function safeSend(http, method, path) {
85
+ try {
86
+ return await http({ method, path, headers: {} });
87
+ }
88
+ catch {
89
+ return null;
90
+ }
91
+ }
92
+ async function runMutationProbes(targets, http, opts = {}) {
93
+ const findings = [];
94
+ const controls = new Map();
95
+ for (const t of targets) {
96
+ const r = await safeSend(http, t.method, t.path);
97
+ const obs = { method: t.method, route: t.route, trigger: r?.status };
98
+ if (!r || !is2xx(r.status)) {
99
+ opts.onObserve?.(obs);
100
+ continue;
101
+ }
102
+ // Control: same method on a random path that cannot exist (sent once per method).
103
+ if (!controls.has(t.method)) {
104
+ controls.set(t.method, await safeSend(http, t.method, `/${probeValue()}`));
105
+ }
106
+ const control = controls.get(t.method) ?? null;
107
+ obs.control = control?.status;
108
+ opts.onObserve?.(obs);
109
+ if (!control || is2xx(control.status))
110
+ continue; // catch-all or no control: proves nothing
111
+ findings.push((0, finding_1.makeFinding)({
112
+ rule: exports.MUTATION_RULE,
113
+ title: `${t.method} route accepts requests without authentication`,
114
+ severity: 'critical',
115
+ category: 'security',
116
+ source: 'dynamic',
117
+ endpoint: `${t.method} ${t.route}`,
118
+ owasp: 'A01:2025',
119
+ cwe: 'CWE-306',
120
+ description: `${t.method} ${t.route} answered HTTP ${r.status} to a request with no credentials (aimed at a record id that does not exist, so no real data was touched). The route handles writes for anonymous callers.`,
121
+ recommendation: 'Put authentication (and an ownership/role check) in front of every route that changes data, and return 401/403 before looking up the record.',
122
+ proof: (0, proof_1.buildProof)({
123
+ request: { method: t.method, url: r.url ?? (0, proof_1.absoluteUrl)(opts.baseUrl, t.path) },
124
+ status: r.status,
125
+ response: r.bodyText,
126
+ control: `Same method on a random non-existent path: HTTP ${control.status}, so this is the route's own answer, not a catch-all.`,
127
+ }),
128
+ }));
129
+ }
130
+ return findings;
131
+ }
132
+ //# sourceMappingURL=mutationProbe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutationProbe.js","sourceRoot":"","sources":["../../src/active/mutationProbe.ts"],"names":[],"mappings":";;;AAiDA,gCAEC;AAED,gDAiCC;AA4BD,8CA6CC;AA/JD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,mCAAqC;AACrC,8CAA+C;AAC/C,4CAA2D;AAI9C,QAAA,aAAa,GA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