penthera 1.4.0 → 1.6.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 (114) hide show
  1. package/CHANGELOG.md +227 -0
  2. package/README.md +148 -575
  3. package/bin/scan.js +19 -0
  4. package/docs/commands/README.md +23 -0
  5. package/docs/commands/action.md +21 -0
  6. package/docs/commands/agents.md +38 -0
  7. package/docs/commands/deps.md +115 -0
  8. package/docs/commands/fix.md +53 -0
  9. package/docs/commands/hook.md +69 -0
  10. package/docs/commands/install.md +53 -0
  11. package/docs/commands/scan.md +100 -0
  12. package/docs/commands/skill.md +58 -0
  13. package/docs/compare/README.md +25 -0
  14. package/docs/compare/github.md +60 -0
  15. package/docs/compare/semgrep.md +54 -0
  16. package/docs/compare/snyk.md +62 -0
  17. package/docs/compare/socket.md +78 -0
  18. package/docs/compare/zap.md +59 -0
  19. package/docs/compliance-cra.md +141 -0
  20. package/docs/compliance-nis2.md +3 -1
  21. package/docs/dashboard.md +244 -0
  22. package/docs/evidence.md +8 -4
  23. package/docs/examples/github-actions-deps.yml +4 -4
  24. package/docs/examples/github-actions-scan.yml +4 -4
  25. package/docs/index.md +11 -2
  26. package/docs/internal-audit.md +83 -0
  27. package/docs/marketing.md +151 -0
  28. package/docs/plan.md +101 -0
  29. package/docs/privacy.md +38 -0
  30. package/docs/references.bib +10 -0
  31. package/docs/references.md +1 -0
  32. package/docs/research/socket-positioning-notes.md +183 -0
  33. package/docs/use-cases/README.md +14 -0
  34. package/docs/use-cases/agencies.md +71 -0
  35. package/docs/use-cases/ai-coding-teams.md +81 -0
  36. package/docs/use-cases/eu-sme-compliance.md +68 -0
  37. package/docs/use-cases/open-source-maintainers.md +75 -0
  38. package/docs/use-cases/solo-founder.md +65 -0
  39. package/lib/blackbox/email-dns.js +5 -0
  40. package/lib/compliance/cra.js +525 -0
  41. package/lib/compliance/questionnaire.js +4 -2
  42. package/lib/deps/capabilities.js +49 -12
  43. package/lib/deps/index.js +314 -30
  44. package/lib/deps/license.js +329 -0
  45. package/lib/deps/lockfile.js +29 -3
  46. package/lib/deps/popular-pypi.json +1 -0
  47. package/lib/deps/python/capabilities.js +447 -0
  48. package/lib/deps/python/index.js +234 -0
  49. package/lib/deps/python/lockfiles.js +359 -0
  50. package/lib/deps/python/source.js +396 -0
  51. package/lib/deps/python/toml.js +219 -0
  52. package/lib/deps/report.js +54 -6
  53. package/lib/deps/source.js +149 -24
  54. package/lib/deps/spdx.json +1 -0
  55. package/lib/deps/typosquat.js +24 -13
  56. package/lib/fix/apply.js +83 -19
  57. package/lib/hook/index.js +345 -0
  58. package/lib/hook/policy.js +62 -0
  59. package/lib/install/index.js +59 -18
  60. package/lib/install/policy.js +27 -7
  61. package/lib/jurisdictions/nl.json +9 -0
  62. package/lib/memory/repo-suppress.js +11 -3
  63. package/lib/references.json +77 -0
  64. package/lib/remediation/index.js +9 -0
  65. package/lib/retirejs.js +69 -17
  66. package/lib/rules/regex-guard.js +368 -0
  67. package/lib/templates.js +13 -6
  68. package/lib/tls.js +7 -0
  69. package/lib/whitebox/aibom.js +384 -0
  70. package/lib/whitebox/frameworks.js +8 -5
  71. package/lib/whitebox/sbom.js +45 -10
  72. package/lib/whitebox/secrets.js +31 -8
  73. package/package.json +8 -3
  74. package/skills/penthera/SKILL.md +55 -8
  75. package/src/cli/deps.js +81 -6
  76. package/src/cli/evidence.js +14 -4
  77. package/src/cli/hook.js +131 -0
  78. package/src/cli/install.js +14 -5
  79. package/src/cli/report-outputs.js +25 -2
  80. package/src/cli/ui.js +89 -0
  81. package/src/cli.js +81 -11
  82. package/src/report/audience.js +10 -10
  83. package/src/report/evidence.js +33 -14
  84. package/src/report/footer.js +11 -0
  85. package/src/report/markdown.js +6 -3
  86. package/src/report/md-escape.js +16 -0
  87. package/src/reporter.js +1 -0
  88. package/src/scan-url.js +5 -1
  89. package/src/ui/api/data.js +309 -0
  90. package/src/ui/api/demo.js +464 -0
  91. package/src/ui/api/routes.js +134 -0
  92. package/src/ui/api/runs.js +243 -0
  93. package/src/ui/api/summarize.js +451 -0
  94. package/src/ui/security.js +153 -0
  95. package/src/ui/server.js +186 -0
  96. package/src/ui/static/app.css +723 -0
  97. package/src/ui/static/favicon.svg +1 -0
  98. package/src/ui/static/index.html +57 -0
  99. package/src/ui/static/js/api.js +29 -0
  100. package/src/ui/static/js/app.js +138 -0
  101. package/src/ui/static/js/charts.js +207 -0
  102. package/src/ui/static/js/copy.js +79 -0
  103. package/src/ui/static/js/dom.js +120 -0
  104. package/src/ui/static/js/format.js +42 -0
  105. package/src/ui/static/js/theme.js +10 -0
  106. package/src/ui/static/js/typer.js +99 -0
  107. package/src/ui/static/js/views/ai.js +68 -0
  108. package/src/ui/static/js/views/deps.js +96 -0
  109. package/src/ui/static/js/views/evidence.js +115 -0
  110. package/src/ui/static/js/views/findings.js +165 -0
  111. package/src/ui/static/js/views/history.js +92 -0
  112. package/src/ui/static/js/views/overview.js +184 -0
  113. package/src/ui/static/js/views/run.js +349 -0
  114. package/src/ui/static/js/views/settings.js +67 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
2
 
3
- <img src="assets/penthera-social.jpg" alt="Penthera: the routine work of a security team, on your own machine" width="840">
3
+ <img src="assets/penthera-social.jpg" alt="Penthera: open-source security for the apps and AI systems you ship" width="840">
4
4
 
5
5
  <br/><br/>
6
6
 
@@ -20,34 +20,69 @@
20
20
 
21
21
  <div align="center">
22
22
 
23
- ### The routine work of a security team, on your own machine.
23
+ ### Open-source security for the apps and AI systems you ship.
24
24
 
25
- **Penthera audits your app, your dependencies, and your AI tooling, fixes what it
26
- can, proves the fix, and writes the evidence. Offline, deterministic, free, and
27
- open source.**
25
+ **Check it before you deploy. Vet what you build with. Keep watching after you
26
+ ship. On your own machine, offline, and free.**
28
27
 
29
28
  </div>
30
29
 
31
30
  ---
32
31
 
33
- ## What it does for you
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
+ ## The problem
34
46
 
35
- Most small teams have no security engineer. Penthera covers the recurring work
36
- one would do, from a CLI or from inside Claude Code and Cursor:
47
+ 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
50
+ 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.
37
52
 
38
- | The job | What Penthera does | Command |
39
- |---------|--------------------|---------|
40
- | **Test the app** | Black-box scan of a live URL (TLS, headers, CORS, auth, JWT, IDOR, OAuth, OpenAPI, opt-in injection and fuzzing) and white-box scan of the repo (routes, trust boundaries, secrets including AI provider keys) | `penthera <url> --repo .` |
41
- | **Vet dependencies** | What every npm package can actually do (install scripts, shell, network, env, obfuscation), what an upgrade added, lookalike names | `penthera deps --base main` |
42
- | **Guard installs** | Shows what a new package brings before any install script runs, and stops it under your policy | `penthera install <pkg>` |
43
- | **Review pull requests** | Comments the dependency capability diff on every PR that touches the lockfile | [GitHub Action](#use-as-a-github-action) |
44
- | **Audit your AI tooling** | Skills, MCP servers, hooks, plugins, and rule files: hidden instructions, unpinned servers, over-broad permissions, silent updates | `penthera agents --home` |
45
- | **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` |
46
- | **Report and prove** | Reports for developers, owners, and auditors; a hashed, signable evidence bundle; NIS2 readiness and incident drafts | `penthera <url> --audience auditor --evidence out/` |
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)* |
47
72
 
48
73
  What it is not: a human pentester, a 24/7 SOC, or incident response. It does the
49
74
  repeatable checks so the people you do have can spend their time on judgement.
50
75
 
76
+ ## Who it is for
77
+
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) |
85
+
51
86
  ## Why you can trust it
52
87
 
53
88
  - **Local and offline.** No account, no telemetry, no cloud. `--offline` limits
@@ -67,70 +102,69 @@ repeatable checks so the people you do have can spend their time on judgement.
67
102
  [48 verified references](docs/references.md), and a reproducible
68
103
  [benchmark](bench/RESULTS.md) with precision and recall.
69
104
 
70
- ---
71
-
72
- ## How Penthera fits with other tools
105
+ ## By the numbers
73
106
 
74
- Penthera is meant to sit next to the tools you already use, not replace them.
75
- Many teams run several of these together. Penthera's SARIF output goes straight
76
- into GitHub code scanning, for example.
107
+ Penthera has no customer logos yet. Here is what can be checked instead.
77
108
 
78
- | | Focus | Where it runs | How it decides | Cost |
79
- |---|---|---|---|---|
80
- | **Penthera** | Your app (URL + repo), your dependencies, your AI tooling, fixes, and EU compliance evidence | Your machine or CI, offline | Readable deterministic rules, with evidence | Free, MIT |
81
- | [Socket](https://socket.dev) | Supply-chain risk across package registries, extensions, and skills | Cloud service, GitHub App, CLI | Package analysis at registry scale, including AI review | Free tier and paid plans |
82
- | [Snyk](https://snyk.io) | Known vulnerabilities in dependencies, code, containers, and IaC | Cloud service, IDE, CLI | Curated vulnerability database plus static analysis | Free tier and paid plans |
83
- | [GitHub Dependabot and code scanning](https://docs.github.com/code-security) | Known-CVE alerts, update PRs, CodeQL | GitHub | Advisory database, CodeQL queries | Free for public repos |
84
- | [OWASP ZAP](https://www.zaproxy.org) | Dynamic testing of web apps | Your machine or CI | Active and passive scan rules | Free, open source |
85
- | [Anthropic OSS Scanner](https://red.anthropic.com/oss-scanner/) | Finding vulnerabilities in established open-source projects | Run by Anthropic, opt-in for maintainers | AI-driven review with reproducible reports | Free for accepted projects |
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).
86
123
 
87
- **Where Penthera adds something:**
88
- - it checks your app, your dependencies and your AI agent setup in one tool;
89
- - it runs entirely on your machine, with no account;
90
- - it fixes what it finds and re-scans to verify the fix;
91
- - it produces NIS2 evidence.
124
+ ---
92
125
 
93
- **Where others go further:** registry-wide package intelligence (Socket), curated
94
- vulnerability data (Snyk, GitHub), and depth of dynamic testing (ZAP).
126
+ ## How Penthera fits with other tools
95
127
 
96
- Descriptions reflect each project's public documentation as of October 2026.
97
- Corrections are welcome by pull request.
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.
98
131
 
99
- ---
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 |
100
140
 
101
- ## Two ways to use it
141
+ All comparisons: [docs/compare/](docs/compare/README.md). Corrections are welcome by pull request.
102
142
 
103
- **As an Agent Skill (recommended).** Let Claude Code or Cursor drive it:
104
- [install once](#run-it), then ask it to "scan my app for security issues", "is
105
- this package safe to add?", or "audit my MCP servers". The agent picks the
106
- check, runs it, and walks you through the fixes.
143
+ ---
107
144
 
108
- **As a CLI.** Run `penthera https://myapp.com`, or just `penthera` for the guided
109
- wizard. See the [quick start](#quick-start).
145
+ ## Run it
110
146
 
111
- ---
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":
112
150
 
113
- ## Why Penthera
151
+ ```bash
152
+ npx skills add danoszz/penthera
153
+ ```
114
154
 
115
- You shipped something fast: vibecoded, AI-assisted, already live. The same models
116
- that helped you build it also make it easy for someone to probe it. Exposed API
117
- routes, missing security headers, weak auth, a hardcoded key in the repo, an AI
118
- provider key in the frontend bundle. Meanwhile the packages, skills, and MCP
119
- servers you pull in run with your credentials, and attackers know it: 2025 and
120
- 2026 brought self-spreading npm worms, malicious MCP servers, and poisoned agent
121
- skills.
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:
122
157
 
123
- Commercial platforms answer this from the cloud, for a fee, often with an AI
124
- judge deciding what is malicious. Penthera answers it on your machine, for free,
125
- with rules you can read.
158
+ ```bash
159
+ curl -fsSL https://raw.githubusercontent.com/danoszz/penthera/main/install.sh | bash
160
+ ```
126
161
 
127
- Penthera is for hardening systems you own. It is powerful, so please use it
128
- carefully. See [Ethical use](#ethical-use--authorization) and the [Disclaimer](#disclaimer).
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).
129
165
 
130
- Shipping in the EU? Penthera also generates your
131
- [NIS2 readiness report, policy pack, incident-report drafts, SBOM, and prefilled
132
- customer security questionnaires](#compliance-nis2-and-the-cyberwetgeving).
133
- Readiness tooling, not a certification.
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.
134
168
 
135
169
  ### What you get
136
170
 
@@ -155,68 +189,27 @@ Every finding carries a confidence label (`confirmed`, `likely`, `potential`,
155
189
  `needs-human-review`), so a heuristic never poses as a certainty. Reports come
156
190
  out as Markdown, JSON, and SARIF, with the fixes in priority order.
157
191
 
158
- ---
159
-
160
- ---
161
-
162
- ## Run it
163
-
164
- **One-line install** (clones the repo, links the CLI, and installs the skill into
165
- Cursor and Claude Code if it finds them):
166
-
167
- ```bash
168
- curl -fsSL https://raw.githubusercontent.com/danoszz/penthera/main/install.sh | bash
169
- ```
170
-
171
- **Or via the Agent Skills CLI** (Cursor, Claude Code, and [40+ agents](https://agentskills.io/clients)):
172
-
173
- ```bash
174
- npx skills add danoszz/penthera
175
- ```
176
-
177
- Then talk to your agent:
178
-
179
- ```
180
- "Scan my localhost:3000 for security issues"
181
- "Run a pre-deploy security audit on staging.myapp.com"
182
- "Find hardcoded secrets in this repo before I push"
183
- ```
184
-
185
- **Or try it with no install at all:**
186
-
187
- ```bash
188
- npx penthera https://your-app.example
189
- ```
190
-
191
- Prefer the terminal? Run `penthera` with no arguments for a guided wizard.
192
-
193
- > The skill adds an authorization gate: it instructs your agent to refuse targets
194
- > you do not own or are not authorized to test.
195
-
196
- ---
197
-
198
- ## Scan modes and profiles
199
-
200
- | Mode | Command | Coverage |
201
- |------|---------|----------|
202
- | **URL scan** | `penthera https://example.com` | TLS, fingerprinting, endpoint discovery, templates, CORS, cookies, JS CVEs, param discovery, OpenAPI/FastAPI probes, security headers, auth hardening |
203
- | **Repo scan** | `penthera --repo ./my-app` | API route discovery (Next.js, Express, Hono, Fastify), trust-boundary mapping, hardcoded-secret scanning (including Anthropic, OpenAI, Gemini, Groq, Hugging Face and other AI provider keys) |
204
- | **Combined** | `penthera https://staging.app --repo .` | Black-box and white-box in one run |
205
- | **Interactive** | `penthera` *(no args)* | Guided wizard (URL plus optional repo scan, Markdown report) |
206
- | **Machine audit** | `penthera --machine` | macOS checks (keyloggers, persistence, rootkits) |
207
- | **Dependencies** | `penthera deps` | What each npm package can do (install scripts, shell, network, env, eval, native, obfuscation), capability diff on upgrades, typosquats. Offline |
208
-
209
- Pick a profile, or add individual flags for more depth:
210
-
211
- | Profile | Command | What runs |
212
- |---------|---------|-----------|
213
- | **quick** | `--profile quick` | Headers, OpenAPI, auth smoke tests (about 10s) |
214
- | **standard** | *(default)* | Full non-destructive scan |
215
- | **deep** | `--profile deep` | recon, injection probes, and API fuzzing |
192
+ ## Commands
216
193
 
217
- Individual flags: `--recon`, `--deep`, `--fuzz`, `--adaptive`, `--nuclei <path>`, `--templates <dirs>`, `--all`
218
-
219
- ---
194
+ | Command | What it does | Details |
195
+ |---|---|---|
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) |
220
213
 
221
214
  ## How it works
222
215
 
@@ -244,361 +237,21 @@ default scan is non-destructive. Payload-based testing is opt-in (`--deep`,
244
237
  `--fuzz`, `--all`) and gated behind explicit confirmation.
245
238
 
246
239
  ---
247
-
248
- ## Quick start
249
-
250
- ```bash
251
- # First time? Run with no args for guided setup
252
- penthera
253
-
254
- # Safe default scan (non-destructive)
255
- penthera https://myapp.com
256
-
257
- # Staging plus source code, full report set
258
- penthera https://staging.myapp.com --repo . --all -o reports/scan.json --sarif reports/scan.sarif
259
-
260
- # Baseline diff: show only new findings since the last scan
261
- penthera https://myapp.com -o reports/scan.json --baseline reports/previous.json
262
-
263
- # Authenticated scan (session cookie or bearer token)
264
- PENTHERA_BEARER=eyJ... penthera https://myapp.com --profile standard
265
- penthera https://myapp.com --auth-cookie "session=abc123"
266
- ```
267
-
268
- Writing to `-o reports/scan.json` also drops a human-readable `reports/scan.md`
269
- next to it. Reports are gitignored by default.
270
-
271
- ### Exit codes
272
-
273
- | Code | Meaning |
274
- |------|---------|
275
- | `0` | No critical or high findings |
276
- | `1` | Critical or high findings detected |
277
- | `2` | Scan failed (unreachable target, bad config) |
278
-
279
- ---
280
-
281
- ## Output
282
-
283
- | Format | Flag | Use |
284
- |--------|------|-----|
285
- | Terminal | *(default)* | Colored summary plus top 3 fixes |
286
- | **Markdown** | `--markdown file.md` or `-o file.json` | Human-readable report (exec summary, findings tables, fixes). Written next to `-o` automatically |
287
- | JSON | `--json` or `-o file.json` | CI pipelines, baseline diffs, custom tooling |
288
- | SARIF | `--sarif file.sarif` | GitHub Security / Code Scanning tab |
289
- | Audience report | `--audience developer\|owner\|auditor` | The same scan written for a developer, an owner or an auditor ([docs/evidence.md](docs/evidence.md#audience-reports)) |
290
- | Your template | `--report-template file.md` | Your own Markdown with `{{summary.critical}}`, `{{#each findings}}`, `{{#if x}}`; no code runs |
291
- | **Evidence bundle** | `--evidence <dir> [--sign-key <ssh-key>]` | All reports plus `manifest.json` with SHA-256s, optionally SSH-signed. Auditors check it with `penthera evidence verify <dir> --allowed-signers <file>` ([docs/evidence.md](docs/evidence.md)) |
292
-
293
- ---
294
-
295
- ## For your AI coding agent
296
-
297
- Penthera ships as an [Agent Skill](https://agentskills.io), the open format used
298
- by Cursor, Claude Code, Claude.ai, and [40+ agent tools](https://agentskills.io/clients).
299
- The skill teaches an agent to run authorized scans, pick the right profile, and
300
- summarize findings, so you can just describe what you want.
301
-
302
- **Install** (any of these):
303
-
304
- ```bash
305
- # Cross-agent, frictionless
306
- npx skills add danoszz/penthera
307
-
308
- # Or the one-line installer (also links the CLI)
309
- curl -fsSL https://raw.githubusercontent.com/danoszz/penthera/main/install.sh | bash
310
-
311
- # Or copy into a single project for team sharing
312
- cp -r skills/penthera .cursor/skills/penthera # Cursor
313
- cp -r skills/penthera .claude/skills/penthera # Claude Code
314
- ```
315
-
316
- Or as a Claude Code plugin (installs the skill):
317
-
318
- ```bash
319
- /plugin marketplace add danoszz/penthera
320
- /plugin install penthera@penthera
321
- ```
322
-
323
- For Claude.ai (web), zip and upload the skill:
324
-
325
- ```bash
326
- npm run package:skill # produces penthera-skill.zip; upload in Settings > Capabilities > Skills
327
- ```
328
-
329
- **Prompts that trigger it:**
330
-
331
- - "Scan my localhost app on port 3000 for security issues"
332
- - "Run a pre-deploy audit on staging.myapp.com and summarize critical findings"
333
- - "Scan this repo for hardcoded secrets and exposed API routes"
334
- - "Compare today's scan to last week's baseline and show only new findings"
335
- - "Generate a SARIF report for GitHub code scanning"
336
- - "Audit my MCP servers, skills and Claude Code hooks"
337
-
338
- The skill adds an authorization gate: it instructs the agent to refuse targets you
339
- do not own or are not authorized to test, and the wizard asks you to confirm before
340
- scanning a remote host. It is an agent-level and interactive safeguard, not something
341
- the raw CLI enforces. You are responsible for every target you pass it. Run preflight
342
- before the first scan:
343
-
344
- ```bash
345
- bash skills/penthera/scripts/preflight.sh http://localhost:3000
346
- ```
347
-
348
- Skill source and workflows live in [`skills/penthera/SKILL.md`](skills/penthera/SKILL.md).
349
-
350
- ---
351
-
352
- ## Audit your agent setup
353
-
354
- Your AI tools run code too. `penthera agents` audits the skills, MCP servers,
355
- hooks, permissions, plugins and rule files that Claude Code, Cursor, Claude
356
- Desktop, VS Code and Copilot load, and grades the setup A to F.
357
-
358
- ```bash
359
- penthera agents # this repo: .mcp.json, .claude/, .cursor/, AGENTS.md, CLAUDE.md, skills/
360
- penthera agents --home # + ~/.claude (hooks, permissions, plugins, skills), ~/.cursor/mcp.json, Claude Desktop
361
- penthera agents ./some-skill # vet a downloaded skill before you install it
362
- penthera agents --pin # write penthera.lock; later runs flag anything that changed
363
- ```
364
-
365
- It is **offline and deterministic**: no LLM judge, no registry lookups, nothing
366
- leaves your machine, and it never modifies the config it reads. Every verdict
367
- is a rule you can read in [`lib/agents/`](lib/agents/), so a skill can't talk
368
- its way past it.
369
-
370
- | Check | What it catches |
371
- |---|---|
372
- | Hidden content | Unicode tag characters (decoded), zero-width and bidi controls, variation-selector smuggling, text pushed past a wall of blank lines or off-screen, instructions in HTML comments, text addressed to the scanner, base64 blobs (decoded and classified), `.pyc`/archives/executables in a skill folder (by magic bytes, so a renamed `.png` doesn't hide one), symlinks that leave the folder |
373
- | Code execution | `curl \| sh`, `wget \| bash`, `bash <(curl …)`, `eval "$(curl …)"`, `base64 -d \| sh`, `exec(base64…)`, PowerShell `iwr \| iex`, in skills, scripts, hooks and MCP launch commands |
374
- | MCP servers | `npx -y` / `uvx` / `bunx` / `pnpm dlx` without an exact version, inline secrets in `env`, headers or args (same rules as the repo secret scan), remote servers over plain `http://` |
375
- | Hooks & permissions | Hooks that auto-approve tool calls or pipe into a shell (including the scripts they run), `Bash(*)` and other wildcard allows, `bypassPermissions`, allow rules for `~/.ssh` and other credential files, wildcards in a skill's `allowed-tools` |
376
- | Plugins | Marketplaces and marketplace plugins not pinned to a commit |
377
- | Rug pulls | `--pin` writes SHA-256 hashes of every skill folder, MCP server definition, hook and installed plugin to `penthera.lock`. A later run reports what changed, appeared or disappeared |
378
-
379
- Each finding names the OWASP [MCP Top 10](https://owasp.org/www-project-mcp-top-10/)
380
- and [Agentic Top 10](https://genai.owasp.org/) (ASI) ids it maps to, and the
381
- usual `--json`, `-o`, `--markdown` and `--sarif` outputs all work. The scanner
382
- is built for the ways LLM-judged skill scanners have been bypassed: it reads
383
- whole files (no context window to overflow), every file in a skill folder (not
384
- just `SKILL.md`), and treats text aimed at a reviewer as a finding rather than
385
- an argument.
386
-
387
- ---
388
-
389
- ## Scan and fix
390
-
391
- Penthera does not just report problems. It closes the loop: ask your agent to fix what it finds, and it detects the issue, applies a framework-aware fix to your code (shown as a diff for you to approve), and re-scans to prove it is resolved.
392
-
393
- ```
394
- "Scan my app and fix what you find"
395
- "Fix the security headers on my Next.js app and re-scan to confirm"
396
- "Find and fix hardcoded secrets in this repo"
397
- ```
398
-
399
- Fixes come from a [remediation playbook](skills/penthera/references/remediation.md) covering Next.js, Express, Fastify, Hono, and FastAPI. They are always shown as diffs for your approval and verified by a re-scan; nothing is applied blindly, and nothing touches production. To build secure-by-default in the first place, see [secure defaults](skills/penthera/references/secure-defaults.md).
400
-
401
- ### Fix recipes
402
-
403
- For the most common findings you don't need an agent at all. `penthera fix` plans deterministic, local fixes and prints each one as a unified diff:
404
-
405
- ```bash
406
- penthera fix --plan --repo . # fresh repo scan, one diff per fix
407
- penthera fix --plan --repo . -o report.json # or use the findings from an earlier scan
408
- penthera fix --apply <id> --repo . # apply one diff after you approve it
409
- ```
410
-
411
- | Recipe | What it changes | Frameworks |
412
- |--------|-----------------|------------|
413
- | `security-headers` | Adds a starter CSP (with `frame-ancestors`), HSTS, X-Frame-Options, Referrer-Policy and X-Content-Type-Options | Next.js (`headers()` in `next.config.*`), Express (`helmet` if installed, otherwise a small middleware), Fastify (`@fastify/helmet` if installed, otherwise an `onSend` hook), Hono (`secureHeaders`) |
414
- | `cookie-flags` | Adds `httpOnly`, `secure` and `sameSite` to cookies set in code | `res.cookie`, `reply.setCookie`, Hono `setCookie`, Next.js `cookies().set` |
415
- | `cors-allowlist` | Replaces `cors()`, `origin: "*"`, `origin: true` and `origin \|\| "*"` with an allowlist from `CORS_ALLOWED_ORIGINS` | Express, Fastify, Hono, Next.js route handlers |
416
- | `auth-rate-limit` | Puts a rate-limit stub (in memory, 10 attempts per 15 minutes) on login and auth routes | Express (`express-rate-limit` if installed), Fastify, Hono, Next.js App Router |
417
- | `secret-to-env` | Moves a hardcoded secret in JS/TS to `process.env.NAME` and adds `NAME=` to `.env.example` | Any |
418
-
419
- How it stays safe:
420
-
421
- - **Planning never writes.** Applying is a separate step: it needs a plan id plus a `y/N` confirmation (or `--yes`), refuses a dirty git tree unless you pass `--allow-dirty`, refuses any path outside the repo, and writes nothing unless every hunk applies. It never commits or pushes.
422
- - **Conservative edits.** No AST rewriting: each recipe edits at an anchor it recognises exactly (`const app = express()`, the exported Next.js config object, a one-line `res.cookie(...)`). If the anchor isn't there, or the code already does something custom (an existing `headers()`, cookie options in a variable), the recipe returns no plan instead of a risky diff.
423
- - **Owner actions are listed, not done.** A recipe can move a secret out of the code but can never rotate it, so every secret fix says "rotate this secret". Other recipes flag what is still on you, such as tightening the starter CSP or setting `CORS_ALLOWED_ORIGINS`.
424
- - **Secrets stay masked.** The secret's value is masked in printed and `--json` plans.
425
- - **Verified.** After `--apply`, Penthera re-scans the repo and says whether each finding is gone. Headers, cookies, CORS and rate limits are checked statically from source, so re-run your URL scan to confirm against the live app.
426
-
427
- No recipe for a finding? `--fix-model <name>` can ask a model running in [Ollama](https://ollama.com) on `127.0.0.1:11434`, and nowhere else. It is off by default and only used when no recipe matches. Its diffs are labelled `needs-human-review`.
428
-
429
- ### The local loop: `penthera agent --loop`
430
-
431
- `penthera agent --loop` runs scan → fix → verify → learn on your machine until nothing fixable is left (or `--max-iterations`, default 5):
432
-
433
- ```bash
434
- penthera agent --loop --repo . --url http://localhost:3000 -o reports/loop.json
435
- ```
436
-
437
- It shows each diff and asks `y/n/skip/quit`, applies it on a local branch `penthera/fix-<yyyymmdd-hhmm>`, re-scans (plus your tests with `--run-tests`), commits the fix if it verified and reverts it if not, and records the outcome in [local memory](docs/local-loop.md). It refuses a dirty tree or a detached HEAD, runs only an allow-list of local git commands with your repo's hooks disabled, contacts only the `--url` host, and never pushes or opens a pull request. `--auto low` applies without asking only recipes that memory shows verified 3+ times with no failures on your framework. Details and the `loopRun` JSON: [docs/local-loop.md](docs/local-loop.md#the-agent-loop).
438
-
439
- ---
440
-
441
- ## Dependency risk: what can your packages do?
442
-
443
- A lockfile change is code you did not write, about to run with your app's access
444
- to files, network, environment and CI secrets. `penthera deps` reads
445
- `package-lock.json`, statically scans every installed package, and tells you
446
- what each one *can do*, and which packages are new or gained capabilities in an
447
- upgrade.
448
-
449
- ```bash
450
- penthera deps # every package in node_modules
451
- penthera deps --base origin/main # capability diff vs the lockfile on main
452
- penthera deps --diff ../base-checkout # diff vs another installed tree (or an old package-lock.json)
453
- penthera deps --pr-comment deps.md # short Markdown diff for a PR comment
454
- ```
455
-
456
- ```
457
- ▲ net-helper 1.0.0 → 1.1.0 + network, whole environment
458
- node_modules/net-helper/index.js:3 const https = require('https');
459
- node_modules/net-helper/index.js:5 const body = JSON.stringify(process.env);
460
- ```
461
-
462
- | Capability | Detected from |
463
- |---|---|
464
- | Install scripts | `preinstall` / `install` / `postinstall`, and `binding.gyp` (npm runs `node-gyp` implicitly). Flagged as risky when the hook pipes a download to a shell or runs a file with network or decoding code |
465
- | Shell, network, dynamic code | `child_process`; `http`/`https`/`net`/`dgram`/`tls`/`http2`, `fetch`, `WebSocket`; `eval`, `new Function`, `vm` |
466
- | Environment | `process.env` reads, and bulk access (`JSON.stringify(process.env)`, enumeration). Serialising the environment next to network code is reported as likely exfiltration |
467
- | Files, modules, native | Writes near home-directory or system paths; computed `require()`/`import()`; `.node` addons and `binding.gyp` |
468
- | Obfuscation | Obfuscator identifiers (`_0x…`), `\x`-escape density, encoded blobs that are decoded and run (embedded WebAssembly and ANSI colour codes are recognised and ignored) |
469
- | Attack indicators | Writes to `~/.claude`, `~/.cursor`, `.mcp.json` or the Claude Desktop config; running the `claude`, `gemini` or `q` CLIs (the s1ngularity pattern); GitHub token harvesting |
470
- | Typosquats | Edit distance, separator and suffix tricks against ~7,800 popular npm names, vendored in the package and refreshed at release time |
471
-
472
- Every capability carries `file:line` evidence. It is a regex-and-tokenizer pass,
473
- not a full parser: deterministic, never executes package code, and fast enough
474
- for every PR (0.4 s for Penthera's own 61 packages, 5 to 16 s for real app
475
- trees of 500 to 1,700 packages). A capability is what code
476
- *can* do, not proof that it is malicious; the findings carry honest confidence
477
- labels (`potential` for obfuscation and typosquats).
478
-
479
- **Offline by default.** Old versions for the diff come from the base tree's
480
- `node_modules` or from npm's local cache (`~/.npm/_cacache`), looked up by the
481
- lockfile's integrity hash and verified byte for byte. `--online` is the only
482
- network use: it asks the npm registry for publish dates, publisher changes and
483
- deprecations, and fetches old tarballs the cache does not have (verified the
484
- same way). To comment the capability diff on every PR that changes the
485
- lockfile, use the GitHub Action below.
486
-
487
- ### Use as a GitHub Action
488
-
489
- ```yaml
490
- - uses: danoszz/penthera@<release-commit-sha> # v1.4.0
491
- with:
492
- mode: deps # deps | agents | scan (scan also needs url:)
493
- fail-on: none # none | high | critical
494
- ```
495
-
496
- On every pull request it posts one comment with the capability diff against
497
- the PR base and edits that same comment on each push. It also uploads SARIF to
498
- code scanning. Penthera runs from the action's own checkout: no npx, no install
499
- from npm, no registry lookups. On fork PRs the token is read-only, so the diff
500
- goes to the job summary instead. Inputs: `mode`, `path`, `base-ref`, `url`,
501
- `fail-on`, `comment`, `sarif`, `penthera-version`. Copy the full workflow, with
502
- permissions and a lockfile paths filter, from
503
- [`docs/examples/pr-dependency-review.yml`](docs/examples/pr-dependency-review.yml).
504
-
505
- ### Install firewall: `penthera install`
506
-
507
- `penthera deps` tells you what changed after the fact. `penthera install` asks
508
- before anything runs:
509
-
510
- ```bash
511
- penthera install left-pad # check, then install (asks if the policy says so)
512
- penthera install -D vitest --dry-run # report only
513
- penthera install --yes # CI: install only if nothing breaches the policy
514
- ```
515
-
516
- ```
517
- ▲ color-helper 1.0.0 → 1.1.0 + install script
518
- postinstall: node postinstall.js
519
-
520
- Policy defaults (no penthera.policy.json)
521
- ! color-helper@1.1.0 needs approval: install script
522
-
523
- Install anyway? [y]es, run the install scripts / [s]kip scripts / [N]o:
524
- ```
525
-
526
- 1. npm resolves the new tree in a temporary copy of `package.json` and the
527
- lockfile, with scripts off (`npm install --package-lock-only --ignore-scripts`).
528
- 2. New tarballs are fetched with `npm cache add`. Nothing is unpacked into
529
- `node_modules` and no package code runs; each tarball is checked against
530
- the proposed lockfile's integrity before it is read.
531
- 3. The `deps` engine diffs capabilities against your current lockfile, lists
532
- new install scripts with their commands, and checks new names for typosquats.
533
- 4. `penthera.policy.json` decides. On approval, the reviewed lockfile is
534
- installed as is, with `--ignore-scripts` unless you approved the scripts
535
- (on npm 12+, approved scripts are pinned in `package.json` `allowScripts`).
536
- On abort, exit code 1, and the project is byte for byte unchanged.
537
-
538
- ```json
539
- {
540
- "allow": ["@acme/*", "esbuild", "sharp@0.33.5"],
541
- "deny": ["ai-cli-invoke", "token-harvest"],
542
- "requireApproval": ["install-scripts", "ai-config-write", "ai-cli-invoke",
543
- "token-harvest", "obfuscated", "typosquat", "unscanned"]
544
- }
545
- ```
546
-
547
- `deny` and `requireApproval` take capability ids from the table above
548
- (`install-scripts`, `shell`, `network`, `env-bulk`, `obfuscated`, ...) plus
549
- `typosquat` and `unscanned`. The `requireApproval` list shown is the default.
550
- `allow` takes names or globs, optionally pinned to a version, and overrides
551
- both. The one network use is npm talking to your configured registry, and
552
- Penthera prints which one; Penthera itself sends nothing. Workspaces and
553
- `file:` dependencies are not supported yet.
554
-
555
- ---
556
-
557
- ## Compliance: NIS2 and the cyberwetgeving
240
+ ## Compliance: NIS2 and the CRA
558
241
 
559
242
  Shipping in the EU? NIS2 (the Cyberbeveiligingswet in the Netherlands, the
560
- NIS2-wet in Belgium) puts a duty of care on in-scope organisations. Penthera
561
- turns the technical, testable part of that duty into repeatable evidence, and
562
- helps with the paperwork around it. Offline, no accounts.
563
-
564
- | Command | What you get |
565
- |---------|--------------|
566
- | `--framework nis2` | Per-run Article 21(2) coverage table in every report |
567
- | `--readiness --assessment a.json` | Full readiness report: every measure marked met / partial / gap |
568
- | `--questionnaire questions.txt` | Customer security questionnaire drafted from your evidence |
569
- | `--policy-pack ./policies` | Proportionate policy templates, prefilled from your gaps |
570
- | `--incident incident.json` | 24h / 72h / 1-month incident report drafts and deadlines |
571
- | `--sbom sbom.cdx.json` | CycloneDX software bill of materials |
572
- | `--history history.json` | Time-to-fix, ageing, and drift across scans |
573
- | `--suppliers suppliers.txt` | Passive red/amber/green rating of your suppliers |
574
-
575
- **Full guide, the measure-by-measure coverage table, and the limits:**
576
- [docs/compliance-nis2.md](docs/compliance-nis2.md).
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).
577
250
 
578
251
  > Readiness tooling, not a certification and not legal advice.
579
252
 
580
253
  ---
581
254
 
582
- ## CI integration
583
-
584
- ```yaml
585
- # Scan a staging URL on a schedule and upload results to GitHub Security.
586
- - run: npx penthera@1.4.0 "$PENTEST_URL" --profile standard --sarif reports/scan.sarif
587
- - uses: github/codeql-action/upload-sarif@v4
588
- with:
589
- sarif_file: reports/scan.sarif
590
- ```
591
-
592
- Copy the full workflow from
593
- [`docs/examples/github-actions-scan.yml`](docs/examples/github-actions-scan.yml)
594
- into your app's repo. Pin the Penthera version so a scheduled run never picks up
595
- code you have not reviewed.
596
-
597
- Penthera's own CI runs the full test suite on Node 22 and 24, self-scans a mock
598
- vulnerable API on every push, and runs CodeQL and OpenSSF Scorecard.
599
-
600
- ---
601
-
602
255
  ## Ethical use & authorization
603
256
 
604
257
  Penthera sends HTTP requests to the targets you give it. Some modes (`--deep`,
@@ -631,86 +284,37 @@ academic or professional penalties.
631
284
 
632
285
  ## Install
633
286
 
634
- The [one-line installer](#run-it) is the fastest path. To set it up manually:
287
+ Requirements: Node.js 22+ and npm. To install from source:
635
288
 
636
289
  ```bash
637
290
  git clone https://github.com/danoszz/penthera.git
638
- cd penthera
639
- npm install
640
- npm link # exposes `penthera` and `penthera-scan` globally
641
- penthera --version
642
- ```
643
-
644
- Requirements: Node.js 22+ and npm. Optional: nuclei-templates for `--nuclei`, and
645
- Docker. To run it in a container:
646
-
647
- ```bash
648
- docker build -t penthera .
649
- docker run --rm penthera https://your-app.example
650
- ```
651
-
652
- ---
653
-
654
- ## Configuration
655
-
656
- For live integration tests against your own routes:
657
-
658
- ```bash
659
- cp pentest.config.example.js pentest.config.js # gitignored
291
+ cd penthera && npm install && npm link # exposes `penthera` globally
660
292
  ```
661
293
 
662
- Edit the route groups, then run `npm run pentest:live`. Set `PENTEST_BASE_URL` to
663
- point at staging without editing the file.
664
-
665
- ---
294
+ Or in a container: `docker build -t penthera . && docker run --rm penthera https://your-app.example`.
666
295
 
667
- ## Testing & contributing
296
+ ## Testing and contributing
668
297
 
669
298
  ```bash
670
299
  npm test # full suite (live integration tests skip without a running target)
671
300
  npm run pentest:mock # offline tests against a local mock vuln API
672
- npm run mock-server # start the mock API on port 8765
301
+ npm run bench # precision and recall on labelled local targets
673
302
  ```
674
303
 
675
- See the [roadmap](ROADMAP.md) for what is next, including auditing the skills,
676
- MCP servers, and plugins in your AI toolchain, and what is deliberately not
677
- planned.
678
-
679
- See [CONTRIBUTING.md](CONTRIBUTING.md) for the project layout, how to add a probe
680
- or template, the test matrix, and the release and publishing checklist.
681
-
682
- ---
683
-
684
- ## Methodology and accuracy
685
-
686
- How Penthera decides what is a finding, how sure it is, and what it cannot
687
- see is written up in [docs/METHODOLOGY.md](docs/METHODOLOGY.md), with every
688
- design choice tied to published research or a standard
689
- ([references](docs/references.md)). Reports carry the same citations: each
690
- finding gets a "Why this matters / Sources" line, and SARIF rules link to their
691
- source.
692
-
693
- Accuracy is measured, not claimed. `npm run bench` scans local labelled
694
- targets offline and scores precision and recall; the current run is 19 true
695
- positives, 3 false positives and 2 false negatives (precision 0.86, recall
696
- 0.90). The [results](bench/RESULTS.md) list every miss and false alarm, and
697
- the [benchmark README](bench/README.md) explains the method and its limits.
698
-
699
- To cite Penthera, use the "Cite this repository" button on GitHub
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
700
309
  ([CITATION.cff](CITATION.cff)).
701
310
 
702
- ---
703
-
704
311
  ## Status
705
312
 
706
- **Production-ready and moving fast.** App scanning (URL, repo, macOS machine),
707
- dependency capability analysis and an install firewall, the AI-tooling audit, the
708
- local fix loop with a learning store, audience reports and evidence bundles, the
709
- PR-comment GitHub Action, and NIS2 readiness tooling are all shipped. See the
710
- [CHANGELOG](CHANGELOG.md) for the full history and the [roadmap](ROADMAP.md) for
711
- what is next.
712
-
713
- Penthera is actively maintained. Issues and PRs welcome.
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.
714
318
 
715
319
  ---
716
320
 
@@ -738,42 +342,11 @@ a security endorsement of that company. Details in
738
342
 
739
343
  ## Privacy
740
344
 
741
- Penthera has no telemetry. It does not collect, store, or transmit any usage data, analytics, or personal information to the author or any third party. It does not phone home.
742
-
743
- - **Scan traffic goes to the target you specify.** Auth tokens passed via `--auth-bearer`, `--auth-cookie`, or `PENTHERA_*` env vars are sent only to that target.
744
- - **Every request identifies itself** as `penthera/<version> (+https://github.com/danoszz/penthera)`, so a target's operator can tell where the traffic comes from. Override it with `--user-agent`.
745
- - **Reports stay local.** Output is written to `reports/` (gitignored) on your machine.
746
- - **Every scan lists the third-party hosts it contacted** besides the target, in the terminal summary and in the report's "Network egress" section.
747
-
748
- Without `--offline`, a scan may contact these third parties:
749
-
750
- | Host | When | What it learns |
751
- |---|---|---|
752
- | `raw.githubusercontent.com`, `cdn.jsdelivr.net` | Retire.js check (standard and deep profiles) | That someone downloaded the public database. Nothing about your target. |
753
- | `crt.sh`, `web.archive.org`, `otx.alienvault.com` | `--recon` only | The target domain. |
754
- | CDN hosts serving your page's `<script src>` | Retire.js check, when a script's version can only be read from its contents | That someone fetched that public script. |
755
-
756
- ### Fully local: `--offline`
757
-
758
- ```bash
759
- penthera http://localhost:3000 --offline
760
- ```
761
-
762
- With `--offline`, the HTTP client refuses every host except the scan target. A redirect may only move to a host on the target's registrable domain (`example.com` to `www.example.com`). In practice:
763
-
764
- - **Recon is skipped.** No queries go to crt.sh, the Wayback Machine or OTX.
765
- - **The Retire.js database comes from the snapshot vendored in the package** (`lib/data/retire-jsrepository.json.gz`), refreshed at each release by `scripts/refresh-retire-db.mjs`. The source URL, fetch date and SHA-256 sit next to it in `retire-jsrepository.meta.json`, so you can check it against upstream. Online scans fall back to the snapshot too when the live download fails.
766
- - **Third-party scripts are not fetched.** A refused request is listed in the report as an inconclusive probe, not passed over silently.
767
- - **`--suppliers` is refused**, because it rates third-party domains.
768
- - **DNS:** reaching a remote target needs DNS. For non-local targets, the email-authentication check also looks up the target domain's SPF/DMARC/MX records through your system resolver. A `localhost` or IP target needs no DNS at all.
769
-
770
- Penthera never fetches rules or code at runtime: templates, wordlists and the vulnerability database ship in the package.
771
-
772
- ### Inconclusive probes
773
-
774
- When a probe's requests time out, fail, or are refused by `--offline`, the scan records `{ probe, url, message }` in `result.errors`. The terminal summary shows "N probes inconclusive", and the Markdown report lists each one. A probe that could not run is not a clean result.
775
-
776
- You are responsible for ensuring you are authorized to scan any target. See [Ethical use](#ethical-use--authorization).
345
+ Penthera has no telemetry and does not phone home. Scan traffic goes to the
346
+ 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
348
+ host except the target. Which hosts a normal scan may contact, and why, is in
349
+ [docs/privacy.md](docs/privacy.md).
777
350
 
778
351
  ---
779
352