penthera 1.6.1 → 1.7.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 (42) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +158 -301
  3. package/bin/scan.js +2 -2
  4. package/docs/METHODOLOGY.md +236 -182
  5. package/docs/commands/README.md +2 -1
  6. package/docs/commands/init.md +114 -0
  7. package/docs/commands/scan.md +1 -1
  8. package/docs/compare/github.md +1 -1
  9. package/docs/dashboard.md +95 -152
  10. package/docs/examples/github-actions-scan.yml +1 -1
  11. package/docs/internal-audit.md +1 -1
  12. package/docs/plan.md +3 -2
  13. package/docs/references.bib +43 -33
  14. package/docs/references.md +92 -51
  15. package/lib/whitebox/frameworks.js +36 -0
  16. package/package.json +1 -1
  17. package/skills/penthera/SKILL.md +19 -5
  18. package/src/cli/deps.js +1 -1
  19. package/src/cli/detect.js +125 -0
  20. package/src/cli/onboarding.js +428 -6
  21. package/src/cli/prompt.js +42 -0
  22. package/src/cli.js +18 -5
  23. package/src/ui/api/data.js +30 -0
  24. package/src/ui/api/demo.js +13 -0
  25. package/src/ui/api/routes.js +1 -0
  26. package/src/ui/static/app.css +286 -560
  27. package/src/ui/static/index.html +8 -39
  28. package/src/ui/static/js/app.js +105 -107
  29. package/src/ui/static/js/center.js +388 -0
  30. package/src/ui/static/js/copy.js +36 -62
  31. package/src/ui/static/js/dom.js +0 -38
  32. package/src/ui/static/js/left.js +83 -0
  33. package/src/ui/static/js/right.js +270 -0
  34. package/src/ui/static/js/state.js +35 -0
  35. package/src/ui/static/js/views/ai.js +0 -68
  36. package/src/ui/static/js/views/deps.js +0 -96
  37. package/src/ui/static/js/views/evidence.js +0 -115
  38. package/src/ui/static/js/views/findings.js +0 -165
  39. package/src/ui/static/js/views/history.js +0 -92
  40. package/src/ui/static/js/views/overview.js +0 -184
  41. package/src/ui/static/js/views/run.js +0 -349
  42. package/src/ui/static/js/views/settings.js +0 -67
package/CHANGELOG.md CHANGED
@@ -4,6 +4,64 @@ All notable changes to Penthera are documented here. Versioning follows [SemVer]
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.7.0] - 2026-10-19
8
+
9
+ One view and one command. `npx penthera` now sets Penthera up in a project:
10
+ it detects what is there, asks what to check, runs it offline and offers the
11
+ hook, the PR workflow and the dashboard. `penthera ui` is a single view with
12
+ side panels. The README is rewritten, and the methodology and references
13
+ follow APA 7.
14
+
15
+ ### Added
16
+
17
+ - **`penthera init`, the setup wizard** (also `npx penthera` with no arguments
18
+ in a terminal). It detects the project offline (git, framework, npm and
19
+ Python lockfiles, agent config, a dev server on localhost, an existing hook
20
+ or workflow), asks one checklist question, runs the code, dependency and AI
21
+ tooling checks (and the running app, only after you confirm it is yours),
22
+ then shows the grade per area, the three things to fix first and one report
23
+ folder, `reports/penthera-<date>/`. It then offers, one yes/no each, the
24
+ pre-commit hook, a `.github/workflows/penthera.yml` pinned to the release
25
+ commit SHA (shown as a diff first), `reports/` in `.gitignore`, the fix loop
26
+ and the dashboard. `--yes` takes the safe defaults and never scans a URL,
27
+ runs the fix loop or opens the dashboard; `--dry-run` prints the plan.
28
+ Nothing is committed or pushed. See [docs/commands/init.md](docs/commands/init.md).
29
+
30
+ ### Changed
31
+
32
+ - **`penthera ui` is one view, like the Claude Code desktop app.** A
33
+ collapsible left sidebar lists projects (grade, open findings, last scan)
34
+ and recent runs grouped by project, with "+ New scan" on top and settings
35
+ behind a gear. The centre is one scrolling stream: the selected project's
36
+ header (grade, severity bar, trend sparkline), what changed since the last
37
+ scan, "Fix first" and the findings; a running scan or fix loop streams there
38
+ as a transcript with Apply / Skip / Stop inline on each diff. A prompt-style
39
+ bar starts scans, dependency checks, AI tooling audits and the fix loop. The
40
+ collapsible right panel stacks Environment (egress, folder, git branch),
41
+ Memory, Dependencies, AI tooling, Evidence and Changes cards, and shows a
42
+ finding's detail when you pick one. `[` and `]` toggle the side panels, which
43
+ become drawers at narrow widths. Calmer chrome, one primary action at a time;
44
+ the themes, `--demo` and every security property are unchanged. New
45
+ `GET /api/env` reads the branch through the agent's hardened git runner.
46
+ - `penthera-scan` keeps the URL-first wizard that `penthera` used to open.
47
+
48
+ ### Docs
49
+
50
+ - README rewritten in the voice of "Penthera: Cyber Security Agent". The
51
+ dashboard screenshots now sit directly under the demo GIF; "Get started" leads
52
+ with one command (`npx penthera`); features are grouped as before you deploy,
53
+ what you build with, and after you ship; and a new "Research and
54
+ methodology" section gives the method, the benchmark numbers, and how to cite
55
+ Penthera. About 12 KB, down from 19 KB.
56
+ - `docs/references.md` is rendered in APA 7th edition style from
57
+ `docs/references.bib`, sorted by first author within each topic, with an
58
+ anchor per BibTeX key. Editors for the three Springer proceedings and the NDSS
59
+ proceedings titles were added from Crossref. A test covers the formatter.
60
+ - `docs/METHODOLOGY.md` uses APA in-text citations, opens with an abstract and
61
+ a "How to cite" block that mirrors `CITATION.cff`, and now cites every
62
+ reference. A test fails if a citation does not resolve or a reference is
63
+ never cited, and the internal audit checks the "How to cite" version.
64
+
7
65
  ## [1.6.1] - 2026-10-19
8
66
 
9
67
  The GitHub Action gets its Marketplace name. Nothing else changes.
package/README.md CHANGED
@@ -1,9 +1,13 @@
1
1
  <div align="center">
2
2
 
3
- <img src="assets/penthera-social.jpg" alt="Penthera: open-source security for the apps and AI systems you ship" width="840">
3
+ <img src="assets/penthera-social.jpg" alt="Penthera: Cyber Security Agent" width="840">
4
4
 
5
5
  <br/><br/>
6
6
 
7
+ **Penthera: Cyber Security Agent. Open-source security for the apps and AI systems you ship.**
8
+
9
+ <br/>
10
+
7
11
  [![npm](https://img.shields.io/npm/v/penthera?color=0000ed)](https://www.npmjs.com/package/penthera)
8
12
  ![node](https://img.shields.io/badge/node-%E2%89%A522-0000ed)
9
13
  ![license](https://img.shields.io/badge/license-MIT-0000ed)
@@ -14,363 +18,216 @@
14
18
 
15
19
  <img src="assets/demo.gif" alt="Penthera running an interactive security scan in the terminal" width="760">
16
20
 
17
- </div>
18
-
19
- ---
20
-
21
- <div align="center">
22
-
23
- ### Open-source security for the apps and AI systems you ship.
21
+ <br/><br/>
24
22
 
25
- **Check it before you deploy. Vet what you build with. Keep watching after you
26
- ship. On your own machine, offline, and free.**
23
+ | `penthera ui`, dark | `penthera ui`, light |
24
+ |---|---|
25
+ | ![The dashboard in the dark theme: projects, findings, and a finding's detail](assets/dashboard/ui-dark.jpg) | ![The dashboard in the light theme: all projects and the side cards](assets/dashboard/ui-light.jpg) |
27
26
 
28
27
  </div>
29
28
 
30
29
  ---
31
30
 
32
- ## Try it in 60 seconds
33
-
34
- No install, no account. Each step runs on your machine and sends nothing to us.
35
-
36
- ```bash
37
- npx penthera agents --home # 1. audit your Claude Code, Cursor and MCP setup
38
- npx penthera deps # 2. what can the packages in this project actually do?
39
- npx penthera http://localhost:3000 # 3. scan the app you are about to ship
40
- ```
41
-
42
- Then read [who it is for](#who-it-is-for), or let your coding agent drive it
43
- with the [Agent Skill](#run-it).
44
-
45
31
  ## The problem
46
32
 
47
33
  Teams now ship apps and AI agents faster than anyone can secure them. AI writes
48
- much of the code. AI pulls in the packages, MCP servers, and skills. And on most
49
- teams nobody does security full time. Attackers have noticed: 2025 and 2026
34
+ much of the code and pulls in the packages, MCP servers, and skills, and on most
35
+ teams nobody works on security full time. Attackers have adapted: 2025 and 2026
50
36
  brought self-spreading npm worms that hijacked AI coding tools, malicious MCP
51
- servers, poisoned agent skills, and leaked AI provider keys running up large bills.
52
-
53
- Commercial platforms answer this from the cloud, for a fee, often with an AI
54
- deciding what is malicious. **Penthera answers it on your machine, for free,
55
- with rules you can read.** Think of it as the open-source security team for
56
- teams that don't have one.
57
-
58
- ## What it does for you
59
-
60
- | | The job | What Penthera does | Command |
61
- |---|---------|--------------------|---------|
62
- | **Before you deploy** | Test the app | Scan your localhost or preview URL (TLS, headers, CORS, auth, JWT, IDOR, OAuth, OpenAPI, opt-in injection and fuzzing) and your repo (routes, trust boundaries, secrets including AI keys) | [`penthera <url> --repo .`](docs/commands/scan.md) |
63
- | | Fix and verify | Deterministic fixes on a local branch, re-scanned to prove they worked, remembered so the next run is sharper. Never pushes | [`penthera agent --loop`](docs/commands/fix.md) |
64
- | | Block it at commit time | Secrets, risky agent config, and dependency changes stopped before they are committed | [`penthera hook install`](docs/commands/hook.md) |
65
- | **What you build with** | Vet dependencies | What every npm and Python package can actually do (install scripts, shell, network, env, obfuscation), what an upgrade added, lookalike names, licenses | [`penthera deps --base main`](docs/commands/deps.md) |
66
- | | Guard installs | Shows what a new package brings before any install script runs, and stops it under your policy | [`penthera install <pkg>`](docs/commands/install.md) |
67
- | | Review pull requests | Comments the dependency capability diff on every PR that touches the lockfile | [GitHub Action](docs/commands/action.md) |
68
- | | Audit your AI tooling | Skills, MCP servers, hooks, plugins, and rule files: hidden instructions, unpinned servers, over-broad permissions, silent updates | [`penthera agents --home`](docs/commands/agents.md) |
69
- | **After you ship** | Report and prove | Reports for developers, owners, and auditors; a hashed, signable evidence bundle; NIS2 and CRA readiness and report drafts | [`penthera <url> --audience auditor --evidence out/`](docs/evidence.md) |
70
- | | See it all | A local dashboard on 127.0.0.1: where each project stands, findings in plain words, history, deps, AI tooling, evidence, and the fix loop with Apply / Skip / Stop per diff | [`penthera ui`](docs/dashboard.md) |
71
- | | Keep watching | Scheduled checks of your own production for drift: certificates, headers, new endpoints, keys in bundles, new CVEs in your SBOM | *on the [roadmap](ROADMAP.md)* |
72
-
73
- What it is not: a human pentester, a 24/7 SOC, or incident response. It does the
74
- repeatable checks so the people you do have can spend their time on judgement.
37
+ servers, poisoned agent skills, and leaked AI provider keys. Penthera does the
38
+ repeatable security work on your own machine, with rules you can read, so the
39
+ people you have can spend their time on judgement.
75
40
 
76
- ## Who it is for
41
+ ## Get started
77
42
 
78
- | You are | Start here |
79
- |---|---|
80
- | A solo founder or vibecoder about to launch | [Before launch](docs/use-cases/solo-founder.md) |
81
- | A team adopting Claude Code or Cursor | [The AI-tooling supply chain](docs/use-cases/ai-coding-teams.md) |
82
- | An open-source maintainer | [For maintainers](docs/use-cases/open-source-maintainers.md) |
83
- | An EU SME with NIS2 or CRA duties | [Evidence for NIS2 and the CRA](docs/use-cases/eu-sme-compliance.md) |
84
- | An agency shipping client apps | [A repeatable handover check](docs/use-cases/agencies.md) |
43
+ One command in your project folder, no install, no account:
85
44
 
86
- ## Why you can trust it
87
-
88
- - **Local and offline.** No account, no telemetry, no cloud. `--offline` limits
89
- network traffic to the target you named, and every report lists the hosts that
90
- were contacted.
91
- - **Deterministic, not an AI verdict.** Rules you can read, with `file:line`
92
- evidence and a confidence label on every finding. No model decides what is
93
- malicious.
94
- - **Never acts behind your back.** The fix loop works on a local branch, asks
95
- before every change by default, and never pushes or opens pull requests.
96
- - **No update channel to hijack.** Detection rules ship inside reviewed releases.
97
- Nothing is downloaded and executed at run time.
98
- - **Releases you can verify.** Published with npm provenance through trusted
99
- publishing, and each version is approved by a maintainer with 2FA before it
100
- goes live. SHA-pinned CI, CodeQL, and OpenSSF Scorecard.
101
- - **Measured and cited.** A published [methodology](docs/METHODOLOGY.md),
102
- [48 verified references](docs/references.md), and a reproducible
103
- [benchmark](bench/RESULTS.md) with precision and recall.
104
-
105
- ## By the numbers
106
-
107
- Penthera has no customer logos yet. Here is what can be checked instead.
108
-
109
- | | |
110
- |---|---|
111
- | Benchmark, labelled local targets | precision 0.86, recall 0.90 (19 true positives, 3 false positives, 2 misses; [every one listed](bench/RESULTS.md)) |
112
- | Detection rules, all readable | 14 URL scan templates, 20 secret and AI-key patterns, 15 dependency capabilities, 39 AI-tooling audit rules, 5 fix recipes |
113
- | Tests | 687 in the suite, run on Node 22 and 24 on every push |
114
- | Release gate | an [internal audit](docs/internal-audit.md) of 8 gates (tests, benchmark drift, self-scan, CLI smoke, packaging, offline egress, supply chain, docs links); [latest report](audit/REPORT.md) |
115
- | Research | a [methodology](docs/METHODOLOGY.md) backed by [48 cited references](docs/references.md) |
116
- | Supply chain of Penthera itself | [OpenSSF Scorecard](https://scorecard.dev/viewer/?uri=github.com/danoszz/penthera), SHA-pinned CI, CodeQL, npm provenance, each release staged and approved with 2FA |
117
- | Network calls in `--offline` mode | only the target you named; the benchmark run made 0 requests to non-loopback hosts |
118
-
119
- Counts as of 2026-10-19. Refresh them with `npm run docs:numbers` (add
120
- `-- --tests` to count tests), `npm run bench` and `npm run audit:internal`. The benchmark targets are small and written
121
- by the same people as the scanner, so they catch regressions rather than
122
- measure real-world accuracy; see [its limits](bench/RESULTS.md#limits-of-these-numbers).
123
-
124
- ---
125
-
126
- ## How Penthera fits with other tools
127
-
128
- Penthera is meant to sit next to the tools you already use. Its SARIF output
129
- goes straight into GitHub code scanning, for example. Each comparison page says
130
- where the other tool goes further and how to run the two together.
131
-
132
- | | Focus | Where it runs | How it decides |
133
- |---|---|---|---|
134
- | **Penthera** | Your app, your dependencies, your AI tooling, fixes, EU evidence | Your machine or CI, offline | Readable deterministic rules, with evidence |
135
- | [Socket](docs/compare/socket.md) | Supply-chain risk across package registries | Cloud service, GitHub App, CLI | Registry-scale package analysis, including AI review |
136
- | [Snyk](docs/compare/snyk.md) | Known vulnerabilities in dependencies, code, containers, IaC | Cloud service, IDE, CLI | Curated vulnerability database plus static analysis |
137
- | [GitHub Dependabot and code scanning](docs/compare/github.md) | Known-CVE alerts, update PRs, CodeQL | GitHub | Advisory database, CodeQL queries |
138
- | [OWASP ZAP](docs/compare/zap.md) | Dynamic testing of web apps | Your machine or CI | Active and passive scan rules |
139
- | [Semgrep](docs/compare/semgrep.md) | Static analysis of your own code | Your machine, CI, cloud platform | Pattern rules, plus a paid cross-file engine |
140
-
141
- All comparisons: [docs/compare/](docs/compare/README.md). Corrections are welcome by pull request.
142
-
143
- ---
45
+ ```bash
46
+ npx penthera
47
+ ```
144
48
 
145
- ## Run it
49
+ This is the guided start (`penthera init`). Penthera detects your setup
50
+ offline, asks what to check, and runs the code, dependency, and AI-tooling
51
+ checks. It scans your running app only after you confirm the app is yours. You
52
+ get a grade per area, the three things to fix first, and one report folder.
53
+ Then it offers, one yes or no at a time, the pre-commit hook, a CI workflow, and
54
+ the dashboard. Nothing is committed or pushed. Details are in
55
+ [docs/commands/init.md](docs/commands/init.md).
146
56
 
147
- **As an Agent Skill (recommended).** Let Claude Code, Cursor or [40+ other
148
- agents](https://agentskills.io/clients) drive it, then ask "scan my app for
149
- security issues", "is this package safe to add?", or "audit my MCP servers":
57
+ When you know what you want, run it directly:
150
58
 
151
59
  ```bash
152
- npx skills add danoszz/penthera
60
+ npx penthera http://localhost:3000 --repo . # scan the app you are about to ship, and its source
61
+ npx penthera deps # what can the packages in this project actually do?
62
+ npx penthera agents --home # audit your Claude Code, Cursor and MCP setup
63
+ npx penthera ui # open the local dashboard on 127.0.0.1
153
64
  ```
154
65
 
155
- **As a CLI.** `npx penthera https://your-app.example`, or install it with the
156
- one-line installer, which also links the skill into Cursor and Claude Code:
66
+ To let your coding agent drive it, add the Agent Skill, then ask "scan my app
67
+ for security issues" or "is this package safe to add?":
157
68
 
158
69
  ```bash
159
- curl -fsSL https://raw.githubusercontent.com/danoszz/penthera/main/install.sh | bash
70
+ npx skills add danoszz/penthera
160
71
  ```
161
72
 
162
- Run `penthera` with no arguments for a guided wizard. Other install routes
163
- (Claude Code plugin, Claude.ai upload, per-project copy) are in
164
- [docs/commands/skill.md](docs/commands/skill.md).
73
+ The skill tells your agent to refuse targets you do not own or are not
74
+ authorized to test. Other install routes (the one-line installer, the Claude
75
+ Code plugin, a per-project copy) are in [docs/commands/skill.md](docs/commands/skill.md).
76
+ Penthera needs Node.js 22 or later. To run it in a container:
77
+ `docker build -t penthera . && docker run --rm penthera https://your-app.example`.
165
78
 
166
- > The skill adds an authorization gate: it instructs your agent to refuse targets
167
- > you do not own or are not authorized to test.
168
79
 
169
- ### What you get
80
+ ## What it does
170
81
 
171
- ```
172
- Findings
173
-
174
- HIGH IDOR/BOLA: GET /api/users/{user_id}
175
- http://localhost:3000/api/users/1 → 200
176
- HIGH OAuth open redirect
177
- http://localhost:3000/api/oauth/callback?redirect_uri=... → 302
178
- MED Missing Content-Security-Policy
179
- MED No login rate limiting detected
180
- http://localhost:3000/api/login → 401
181
- LOW Missing X-Frame-Options
182
- INFO Missing Referrer-Policy
183
-
184
- ──────────────────────────────────────────────────────────
185
- 2 high · 5 medium · 2 low · 2 info
186
- ```
187
-
188
- Every finding carries a confidence label (`confirmed`, `likely`, `potential`,
189
- `needs-human-review`), so a heuristic never poses as a certainty. Reports come
190
- out as Markdown, JSON, and SARIF, with the fixes in priority order.
82
+ ### Before you deploy
191
83
 
192
- ## Commands
193
-
194
- | Command | What it does | Details |
84
+ | Job | What Penthera does | Command |
195
85
  |---|---|---|
196
- | `penthera <url> [--repo .]` | Black-box and white-box scan; `--profile quick\|standard\|deep` | [scan.md](docs/commands/scan.md) |
197
- | `penthera agents [--home] [--pin]` | Audit skills, MCP servers, hooks, permissions, plugins, rule files; graded A to F | [agents.md](docs/commands/agents.md) |
198
- | `penthera deps [--base main]` | Capabilities of every npm and Python package, upgrade diff, typosquats, `--license-policy` | [deps.md](docs/commands/deps.md) |
199
- | `penthera install <pkg>` | Install firewall: review before any install script runs | [install.md](docs/commands/install.md) |
200
- | `penthera fix --plan`, `penthera agent --loop` | Deterministic fixes as diffs; the local scan, fix, verify, learn loop | [fix.md](docs/commands/fix.md) |
201
- | `penthera hook install` | Pre-commit hook on staged changes, about 0.1 to 0.5 s | [hook.md](docs/commands/hook.md) |
202
- | `uses: danoszz/penthera@<sha>` | PR comment with the capability diff, plus SARIF | [action.md](docs/commands/action.md) |
203
- | `penthera --machine` | macOS checks (persistence, keyloggers, rootkits) | [scan.md](docs/commands/scan.md) |
204
- | `penthera ui [--open] [--demo]` | Local dashboard on 127.0.0.1; runs scans and the fix loop from the page | [dashboard.md](docs/dashboard.md) |
205
-
206
- Scans, `agents` and `deps` write Markdown, JSON and SARIF (`--markdown`,
207
- `--json`, `--sarif`). Exit code `1` means critical or high findings, `2` means
208
- the scan failed.
209
-
210
- | `penthera ui`, dark | `penthera ui`, light |
211
- |---|---|
212
- | ![The dashboard overview in the dark theme](assets/dashboard/overview-dark.jpg) | ![The dashboard overview in the light theme](assets/dashboard/overview-light.jpg) |
213
-
214
- ## How it works
215
-
216
- ```mermaid
217
- flowchart LR
218
- U["You / your AI agent"] --> P((Penthera))
219
-
220
- P --> APP["Your app<br/>black-box URL scan<br/>white-box repo scan"]
221
- P --> DEP["Your dependencies<br/>capabilities, upgrade diff<br/>install firewall, typosquats"]
222
- P --> AI["Your AI tooling<br/>skills, MCP, hooks<br/>plugins, rule files"]
223
-
224
- APP --> F[["Findings<br/>severity, confidence<br/>evidence, sources"]]
225
- DEP --> F
226
- AI --> F
227
-
228
- F --> FIX["Fix loop<br/>local branch, re-scan<br/>learn, never push"]
229
- FIX -.verified.-> F
230
- F --> R["Reports<br/>terminal, Markdown, JSON<br/>SARIF, audience views"]
231
- F --> E["Evidence<br/>hashed, signable bundle<br/>NIS2 readiness"]
232
- ```
233
-
234
- Findings map to the [OWASP Web Security Testing Guide](docs/owasp-wstg-coverage.md)
235
- (WSTG v4.2), and agent findings to the OWASP MCP and Agentic Top 10s. The
236
- default scan is non-destructive. Payload-based testing is opt-in (`--deep`,
237
- `--fuzz`, `--all`) and gated behind explicit confirmation.
238
-
239
- ---
240
- ## Compliance: NIS2 and the CRA
241
-
242
- Shipping in the EU? NIS2 (the Cyberbeveiligingswet in the Netherlands, the
243
- NIS2-wet in Belgium) puts a duty of care on in-scope organisations, and the
244
- Cyber Resilience Act adds reporting duties for products with digital elements.
245
- Penthera turns the technical, testable part into repeatable evidence: an
246
- Article 21(2) coverage table (`--framework nis2`), a readiness report, policy
247
- templates, incident and CRA Article 14 report drafts with deadlines, a CycloneDX
248
- SBOM and AI-BOM, and prefilled customer questionnaires. Offline, no accounts.
249
- Guides: [NIS2](docs/compliance-nis2.md) and [CRA](docs/compliance-cra.md).
250
-
251
- > Readiness tooling, not a certification and not legal advice.
252
-
253
- ---
254
-
255
- ## Ethical use & authorization
256
-
257
- Penthera sends HTTP requests to the targets you give it. Some modes (`--deep`,
258
- `--fuzz`, `--all`) send attack payloads designed to find vulnerabilities. Use it
259
- responsibly.
86
+ | Test the app | Scans your localhost or preview URL (TLS, headers, CORS, auth, JWT, IDOR, OAuth, OpenAPI; injection and fuzzing on request) and your repository (routes, trust boundaries, secrets including AI keys) | [`penthera <url> --repo .`](docs/commands/scan.md) |
87
+ | Fix and verify | Applies deterministic fixes on a local branch, re-scans to prove they worked, and remembers the result. Never pushes | [`penthera agent --loop`](docs/commands/fix.md) |
88
+ | Block it at commit time | Stops secrets, risky agent config, and dependency changes before they are committed | [`penthera hook install`](docs/commands/hook.md) |
260
89
 
261
- **You may use Penthera when:**
262
-
263
- - You **own** the target (your app, your server, your project).
264
- - You have **written authorization** from the system owner (email, ticket, signed scope).
265
- - You scan **localhost** or private lab environments you control.
266
- - You use it for **defensive security**: research, coursework, CI hardening, pre-release audits.
267
-
268
- **You must not use Penthera to:**
269
-
270
- - Scan systems you do not own or lack explicit permission to test.
271
- - Probe government, healthcare, financial, or third-party production systems without authorization.
272
- - Exfiltrate data, disrupt services, or bypass access controls.
273
- - Use findings to attack, extort, or harm anyone.
274
-
275
- > Before scanning any URL that is not localhost, confirm you have permission.
276
- > **When in doubt, do not scan.**
277
-
278
- Unauthorized security testing may violate computer-misuse laws (for example the US
279
- CFAA, the UK Computer Misuse Act, and EU national equivalents) and can result in
280
- criminal prosecution, civil liability, IP blocking, account termination, and
281
- academic or professional penalties.
282
-
283
- ---
90
+ ### What you build with
284
91
 
285
- ## Install
92
+ | Job | What Penthera does | Command |
93
+ |---|---|---|
94
+ | Vet dependencies | Shows what every npm and Python package can do (install scripts, shell, network, env, obfuscation), what an upgrade added, lookalike names, and licenses | [`penthera deps --base main`](docs/commands/deps.md) |
95
+ | Guard installs | Shows what a new package brings before any install script runs, and stops it under your policy | [`penthera install <pkg>`](docs/commands/install.md) |
96
+ | Review pull requests | Comments the dependency capability diff on every PR that touches the lockfile | [GitHub Action](docs/commands/action.md) |
97
+ | Audit your AI tooling | Checks skills, MCP servers, hooks, plugins, and rule files for hidden instructions, unpinned servers, over-broad permissions, and silent updates | [`penthera agents --home`](docs/commands/agents.md) |
286
98
 
287
- Requirements: Node.js 22+ and npm. To install from source:
99
+ ### After you ship
288
100
 
289
- ```bash
290
- git clone https://github.com/danoszz/penthera.git
291
- cd penthera && npm install && npm link # exposes `penthera` globally
292
- ```
101
+ | Job | What Penthera does | Command |
102
+ |---|---|---|
103
+ | Report and prove | Writes reports for developers, owners, and auditors; a hashed, signable evidence bundle; NIS2 and CRA readiness reports and drafts | [`penthera <url> --audience auditor --evidence out/`](docs/evidence.md) |
104
+ | See it all | A local dashboard on 127.0.0.1: one view with your projects, findings in plain words, history, side panels for dependencies, AI tooling and evidence, and the fix loop with Apply, Skip, and Stop per diff | [`penthera ui`](docs/dashboard.md) |
105
+ | Keep watching | Scheduled checks of your production for drift: certificates, headers, new endpoints, keys in bundles, new CVEs in your SBOM | on the [roadmap](ROADMAP.md) |
293
106
 
294
- Or in a container: `docker build -t penthera . && docker run --rm penthera https://your-app.example`.
107
+ Every finding carries a severity, a confidence label (`confirmed`, `likely`,
108
+ `potential`, `needs-human-review`), its evidence, and the research behind it.
109
+ Reports come out as Markdown, JSON, and SARIF for GitHub code scanning. Exit
110
+ code `1` means critical or high findings. Every command and flag is in
111
+ [docs/commands/](docs/commands/README.md).
295
112
 
296
- ## Testing and contributing
113
+ Penthera is not a human pentester, a 24/7 SOC, or incident response. It does
114
+ the checks that can be automated reliably and says plainly which ones need a
115
+ person.
297
116
 
298
- ```bash
299
- npm test # full suite (live integration tests skip without a running target)
300
- npm run pentest:mock # offline tests against a local mock vuln API
301
- npm run bench # precision and recall on labelled local targets
302
- ```
117
+ ## Why you can trust it
303
118
 
304
- How Penthera decides what is a finding, how sure it is, and what it cannot see
305
- is in [docs/METHODOLOGY.md](docs/METHODOLOGY.md), with every design choice tied
306
- to a [reference](docs/references.md). See [CONTRIBUTING.md](CONTRIBUTING.md) for
307
- the project layout and release checklist, and the [roadmap](ROADMAP.md) for what
308
- is next. To cite Penthera, use the "Cite this repository" button on GitHub
309
- ([CITATION.cff](CITATION.cff)).
119
+ - **Local and offline.** No account, no telemetry, no cloud. `--offline` limits
120
+ network traffic to the target you named, and every report lists the hosts it
121
+ contacted.
122
+ - **Deterministic.** Rules you can read, with `file:line` evidence. No model
123
+ decides what is malicious.
124
+ - **Non-destructive by default.** The default scan sends only requests a
125
+ browser would send. Payload testing (`--deep`, `--fuzz`, `--all`) is opt-in
126
+ and asks for confirmation.
127
+ - **Never acts behind your back.** The fix loop works on a local branch, asks
128
+ before every change by default, and never pushes or opens pull requests.
129
+ - **No update channel to hijack.** Detection rules ship inside reviewed
130
+ releases. Nothing is downloaded and executed at run time.
131
+ - **Releases you can verify.** npm provenance through trusted publishing, a
132
+ maintainer approval with 2FA for every version, SHA-pinned CI, CodeQL, and
133
+ OpenSSF Scorecard. Every release passes an
134
+ [internal audit](docs/internal-audit.md) of eight gates
135
+ ([latest report](audit/REPORT.md)).
136
+
137
+ ## Research and methodology
138
+
139
+ Penthera's method is written down and tied to the literature. The
140
+ [methodology](docs/METHODOLOGY.md) states the threat model, separates what
141
+ black-box (HTTP) and white-box (source) analysis can and cannot observe, and
142
+ defines a confidence model that keeps heuristics from posing as facts. Each
143
+ probe has explicit false-positive controls, such as randomized canaries and
144
+ repeated timing measurement, and each design choice cites the research or
145
+ standard it rests on: 49 verified references, listed in APA style in
146
+ [docs/references.md](docs/references.md).
147
+
148
+ | Measure | Result |
149
+ |---|---|
150
+ | Precision on the bundled benchmark | 0.86 (19 true positives, 3 false positives) |
151
+ | Recall on the bundled benchmark | 0.90 (2 misses, [each one explained](bench/RESULTS.md)) |
152
+ | Requests to non-loopback hosts during the benchmark | 0 |
153
+ | Detection rules, all readable | 14 URL scan templates, 20 secret and AI-key patterns, 15 dependency capabilities, 39 AI-tooling rules, 5 fix recipes |
310
154
 
311
- ## Status
155
+ The benchmark targets are small and were written by the same people as the
156
+ scanner, so the numbers catch regressions rather than measure real-world
157
+ accuracy ([limits](bench/RESULTS.md#limits-of-these-numbers)). Counts as of
158
+ 2026-10-19; refresh them with `npm run docs:numbers` and `npm run bench`.
312
159
 
313
- App scanning (URL, repo, macOS machine), dependency capability analysis and an
314
- install firewall, the AI-tooling audit, the local fix loop with a learning
315
- store, audience reports and evidence bundles, the PR-comment GitHub Action, the
316
- pre-commit hook, and NIS2 and CRA readiness tooling are all shipped. See the
317
- [CHANGELOG](CHANGELOG.md) for the history. Issues and PRs welcome.
160
+ **Cite this repository.** Use the button on GitHub, or the metadata in
161
+ [CITATION.cff](CITATION.cff). The APA and BibTeX forms are in the
162
+ [methodology](docs/METHODOLOGY.md#how-to-cite).
318
163
 
319
- ---
164
+ ## How it fits with other tools
320
165
 
321
- ## Support Penthera
166
+ Penthera works next to the tools you already use. Its SARIF output goes
167
+ straight into GitHub code scanning, for example. Each comparison page says where
168
+ the other tool goes further and how to run the two together.
322
169
 
323
- Penthera is free and MIT-licensed. If it caught something before you shipped it,
324
- you can help keep it maintained:
170
+ | | Focus | Where it runs | How it decides |
171
+ |---|---|---|---|
172
+ | **Penthera** | Your app, dependencies, and AI tooling; fixes; EU evidence | Your machine or CI, offline | Readable deterministic rules, with evidence |
173
+ | [Socket](docs/compare/socket.md) | Supply-chain risk across package registries | Cloud service, GitHub App, CLI | Registry-scale package analysis, including AI review |
174
+ | [Snyk](docs/compare/snyk.md) | Known vulnerabilities in dependencies, code, containers, IaC | Cloud service, IDE, CLI | Curated vulnerability database plus static analysis |
175
+ | [GitHub Dependabot and code scanning](docs/compare/github.md) | Known-CVE alerts, update PRs, CodeQL | GitHub | Advisory database, CodeQL queries |
176
+ | [OWASP ZAP](docs/compare/zap.md) | Dynamic testing of web apps | Your machine or CI | Active and passive scan rules |
177
+ | [Semgrep](docs/compare/semgrep.md) | Static analysis of your own code | Your machine, CI, cloud platform | Pattern rules, plus a paid cross-file engine |
325
178
 
326
- [![Sponsor on GitHub](https://img.shields.io/badge/Sponsor-GitHub-db61a2?logo=githubsponsors)](https://github.com/sponsors/danoszz)
179
+ All comparisons: [docs/compare/](docs/compare/README.md). Corrections are
180
+ welcome by pull request.
327
181
 
328
- | Tier | Monthly | You get |
329
- |------|---------|---------|
330
- | Individual | $5 | Thanks, and your name on the GitHub sponsors list |
331
- | Supporter | $25 | A mention in the next release notes |
332
- | Startup | $100 | Your name and link in this README |
333
- | Company | $500 | Your logo in this README, and a quarterly roadmap call |
182
+ ## Use cases
334
183
 
335
- Sponsorship pays for maintainer time: keeping detection rules current, security
336
- fixes, and the [roadmap](ROADMAP.md). It does not buy influence over findings,
337
- a support SLA, or early access to vulnerability reports, and a logo here is not
338
- a security endorsement of that company. Details in
339
- [docs/funding/sponsor-tiers.md](docs/funding/sponsor-tiers.md).
184
+ | You are | Start here |
185
+ |---|---|
186
+ | A solo founder or vibecoder about to launch | [Before launch](docs/use-cases/solo-founder.md) |
187
+ | A team adopting Claude Code or Cursor | [The AI-tooling supply chain](docs/use-cases/ai-coding-teams.md) |
188
+ | An open-source maintainer | [For maintainers](docs/use-cases/open-source-maintainers.md) |
189
+ | An EU SME with NIS2 or CRA duties | [Evidence for NIS2 and the CRA](docs/use-cases/eu-sme-compliance.md) ([NIS2 guide](docs/compliance-nis2.md), [CRA guide](docs/compliance-cra.md)) |
190
+ | An agency shipping client apps | [A repeatable handover check](docs/use-cases/agencies.md) |
340
191
 
341
- ---
192
+ Compliance output is readiness tooling. It is not a certification and not
193
+ legal advice.
342
194
 
343
195
  ## Privacy
344
196
 
345
197
  Penthera has no telemetry and does not phone home. Scan traffic goes to the
346
198
  target you name, reports stay on your machine, and every scan lists any
347
- third-party host it contacted. With `--offline` the HTTP client refuses every
199
+ third-party host it contacted. With `--offline`, the HTTP client refuses every
348
200
  host except the target. Which hosts a normal scan may contact, and why, is in
349
201
  [docs/privacy.md](docs/privacy.md).
350
202
 
351
- ---
203
+ ## Ethics and authorization
352
204
 
353
- ## Disclaimer
205
+ Penthera sends HTTP requests to the targets you give it, and some modes
206
+ (`--deep`, `--fuzz`, `--all`) send attack payloads. Scan only what you own, what
207
+ you have written authorization to test, or local environments you control.
208
+ Do not use it to probe third-party systems, exfiltrate data, disrupt services,
209
+ or harm anyone. Unauthorized testing may break computer-misuse laws such as the
210
+ US CFAA, the UK Computer Misuse Act, and their EU equivalents. When in doubt, do
211
+ not scan.
354
212
 
355
- Penthera is provided for legitimate security research and defensive testing of
356
- systems you own or are authorized to test, and for that purpose only.
213
+ The software is provided "as is", without warranty, for defensive testing of
214
+ systems you own or are authorized to test. The author accepts no liability for
215
+ misuse, and you are responsible for making sure every scan you run is lawful.
357
216
 
358
- - It is a research and self-assessment tool. Scan your own apps to find and fix
359
- weaknesses before attackers do.
360
- - The same capabilities that harden a system can cause harm if pointed at someone
361
- else's. Use it carefully and lawfully.
362
- - The author does not condone unauthorized or malicious use, and accepts no
363
- liability for any damage, loss, or legal consequence arising from use or misuse
364
- of this software.
365
- - The software is provided "as is", without warranty of any kind. See [LICENSE](LICENSE) (MIT).
366
- - You are solely responsible for ensuring every scan you run is authorized and
367
- legal in your jurisdiction.
217
+ ## Contributing and support
368
218
 
369
- By using Penthera you accept these terms.
219
+ Clone the repository and run `npm install`, then `npm test` for the suite and
220
+ `npm run bench` for precision and recall.
221
+ [CONTRIBUTING.md](CONTRIBUTING.md) covers the project layout and the release
222
+ checklist, and the [roadmap](ROADMAP.md) shows what is next. Issues and pull
223
+ requests are welcome.
370
224
 
371
- ---
225
+ Penthera is free. If it caught something before you shipped it, you can
226
+ [sponsor its maintenance](https://github.com/sponsors/danoszz). Sponsorship pays
227
+ for maintainer time and buys no influence over findings
228
+ ([tiers](docs/funding/sponsor-tiers.md)).
372
229
 
373
- ## License & disclosure
230
+ ## License
374
231
 
375
- MIT. See [LICENSE](LICENSE). Report vulnerabilities in Penthera itself via
376
- [SECURITY.md](SECURITY.md). Only scan systems you own or are authorized to test.
232
+ MIT. See [LICENSE](LICENSE). Report vulnerabilities in Penthera itself through
233
+ [SECURITY.md](SECURITY.md).
package/bin/scan.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Alias: penthera-scan
5
5
  */
6
6
  import { readFileSync } from "node:fs";
7
- import { runOnboarding } from "../src/cli/onboarding.js";
7
+ import { runScanWizard } from "../src/cli/onboarding.js";
8
8
 
9
9
  const arg = process.argv[2];
10
10
  if (arg === "--help" || arg === "-h") {
@@ -24,7 +24,7 @@ if (arg === "--version") {
24
24
  process.exit(0);
25
25
  }
26
26
 
27
- runOnboarding().catch((e) => {
27
+ runScanWizard().catch((e) => {
28
28
  console.error(e.message);
29
29
  process.exit(2);
30
30
  });