penthera 1.1.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 (74) hide show
  1. package/CHANGELOG.md +168 -0
  2. package/LICENSE +21 -0
  3. package/README.md +561 -0
  4. package/SECURITY.md +31 -0
  5. package/bin/penthera.js +3 -0
  6. package/bin/scan.js +11 -0
  7. package/docs/index.md +60 -0
  8. package/docs/owasp-wstg-coverage.md +79 -0
  9. package/lib/adaptive-probes.js +334 -0
  10. package/lib/attack-surface.js +149 -0
  11. package/lib/audit-loop.js +170 -0
  12. package/lib/blackbox/adaptive-scan.js +137 -0
  13. package/lib/blackbox/client-auth.js +60 -0
  14. package/lib/blackbox/email-dns.js +135 -0
  15. package/lib/blackbox/headers.js +91 -0
  16. package/lib/blackbox/idor.js +113 -0
  17. package/lib/blackbox/jwt.js +73 -0
  18. package/lib/blackbox/oauth.js +50 -0
  19. package/lib/blackbox/openapi.js +227 -0
  20. package/lib/compliance/incident.js +169 -0
  21. package/lib/compliance/index.js +163 -0
  22. package/lib/compliance/policy-pack.js +293 -0
  23. package/lib/compliance/questionnaire.js +113 -0
  24. package/lib/compliance/readiness.js +229 -0
  25. package/lib/compliance/self-assessment.js +66 -0
  26. package/lib/crawler.js +257 -0
  27. package/lib/fuzzer.js +233 -0
  28. package/lib/injections.js +676 -0
  29. package/lib/jurisdictions/nl.json +48 -0
  30. package/lib/knowledge-graph.js +232 -0
  31. package/lib/machine.js +814 -0
  32. package/lib/nuclei-loader.js +283 -0
  33. package/lib/owasp-wstg.js +204 -0
  34. package/lib/params.js +235 -0
  35. package/lib/plugins.js +70 -0
  36. package/lib/provenance.js +82 -0
  37. package/lib/recon.js +193 -0
  38. package/lib/remediation/index.js +219 -0
  39. package/lib/retirejs.js +239 -0
  40. package/lib/supply-chain.js +131 -0
  41. package/lib/templates.js +364 -0
  42. package/lib/tls.js +145 -0
  43. package/lib/whitebox/frameworks.js +139 -0
  44. package/lib/whitebox/sbom.js +144 -0
  45. package/lib/whitebox/secrets.js +111 -0
  46. package/package.json +76 -0
  47. package/pentest.config.example.js +82 -0
  48. package/scripts/package-skill.sh +16 -0
  49. package/skills/penthera/SKILL.md +272 -0
  50. package/skills/penthera/references/authorization.md +36 -0
  51. package/skills/penthera/references/output-and-ci.md +109 -0
  52. package/skills/penthera/references/profiles-and-flags.md +74 -0
  53. package/skills/penthera/references/remediation.md +267 -0
  54. package/skills/penthera/references/reporting.md +113 -0
  55. package/skills/penthera/references/secure-defaults.md +41 -0
  56. package/skills/penthera/references/troubleshooting.md +100 -0
  57. package/skills/penthera/scripts/preflight.sh +66 -0
  58. package/skills/penthera/scripts/validate-report.mjs +53 -0
  59. package/skills/penthera/scripts/validate-report.sh +8 -0
  60. package/src/cli/ansi.js +70 -0
  61. package/src/cli/baseline.js +37 -0
  62. package/src/cli/merge-results.js +71 -0
  63. package/src/cli/onboarding.js +216 -0
  64. package/src/cli/profiles.js +53 -0
  65. package/src/cli/prompt.js +64 -0
  66. package/src/cli/run-scan.js +152 -0
  67. package/src/cli.js +536 -0
  68. package/src/report/markdown.js +182 -0
  69. package/src/reporter.js +512 -0
  70. package/src/scan-repo.js +205 -0
  71. package/src/scan-url.js +563 -0
  72. package/src/utils/auth.js +13 -0
  73. package/src/utils/http.js +38 -0
  74. package/src/utils/url.js +54 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,168 @@
1
+ # Changelog
2
+
3
+ All notable changes to Penthera are documented here. Versioning follows [SemVer](https://semver.org/).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [1.1.0] - 2026-08-16
8
+
9
+ NIS2 / Cyberbeveiligingswet readiness work: a hardening pass over the
10
+ open-source core, a full offline NIS2 readiness toolkit, and a humanizing pass
11
+ that removed AI-writing tells (em dashes and so on) from all public-facing text
12
+ and generated documents.
13
+
14
+ ### Added
15
+
16
+ - **Customer security-questionnaire answerer** (`--questionnaire <file>`): reads a
17
+ questionnaire (one question per line) and drafts an answer for each from the
18
+ readiness evidence, citing the Article 21 measure and what backs it (scan
19
+ probe or attestation). Anything it can't map is marked NEEDS HUMAN INPUT
20
+ rather than guessed. Writes `questionnaire-response.md`
21
+ - **Attack chains surfaced in reports**: the adaptive engine's knowledge graph
22
+ already correlated findings (for example an auth bypass that combines with an
23
+ IDOR into cross-user access) but the result was computed nowhere. Chains now
24
+ appear as findings with their path
25
+ - **Provenance + honest confidence on every finding**: each finding carries
26
+ `{ source, method, collected_at, confidence }`, with confidence labelled
27
+ `confirmed` / `likely` / `potential` / `needs-human-review` so a heuristic
28
+ isn't presented as a certainty. Shown in the report's Confidence column and in
29
+ JSON (`lib/provenance.js`)
30
+ - **Supplier passive rating** (`--suppliers <file>`): point Penthera's passive
31
+ checks (homepage security headers, TLS certificate, SPF/DMARC/MX via DNS) at
32
+ your own suppliers' public domains and get a red/amber/green posture per
33
+ supplier, supply-chain risk screening (measure d). Strictly passive,
34
+ public-data-only, non-intrusive, and documented as such; not a pentest of the
35
+ supplier
36
+ - **Remediation / audit-loop tracking** (`--history <file>`): folds each scan's
37
+ findings into a persistent history keyed by a stable fingerprint (severity-
38
+ and count-independent), and reports open vs resolved, median time-to-fix,
39
+ ageing buckets, and drift since last scan, the effectiveness evidence for
40
+ measure f, and a "close the loop" counter to noisy discovery-only scanning
41
+ - **SBOM output** (`--sbom <file>`): generates a CycloneDX 1.5 software bill of
42
+ materials from `package-lock.json` / `package.json` / `requirements.txt`,
43
+ offline, with resolved versions and purls. Supply-chain evidence (measure d)
44
+ and the artifact enterprises increasingly require of suppliers
45
+ - **Incident-report helper** (`--incident <file>`, `--incident-init` to scaffold):
46
+ computes the NIS2 reporting deadlines (24h early warning / 72h notification /
47
+ 1-month final report) from when you became aware, flags overdue ones, and
48
+ drafts each report against the jurisdiction's required content, with
49
+ `NEEDS INPUT` markers for facts you still have to supply. Offline; drafts to
50
+ help meet the deadlines, not a substitute for the authority's official form
51
+ - **Policy-pack generator** (`--policy-pack <dir>`): writes proportionate,
52
+ editable Markdown starting points for the core policies NIS2 expects
53
+ (information security, access control, incident response, backup/continuity,
54
+ acceptable use, supplier security, vulnerability management). Pre-filled from
55
+ the jurisdiction's incident deadlines and the readiness gaps; clearly labelled
56
+ as templates, not legal advice
57
+ - **NIS2 readiness report** (`--readiness`): combines scan evidence with an
58
+ offline **self-assessment** (`--assessment-init` to scaffold, `--assessment` to
59
+ supply) into a per-measure `met / partial / gap / n-a` report across all ten
60
+ Article 21 measures, with proportionality notes, the jurisdiction's
61
+ incident-reporting deadlines, and **provenance** (`source, method, collected_at,
62
+ confidence`) on every piece of evidence. Writes `<output>-readiness.md`. Works
63
+ offline; jurisdiction data is config (`lib/jurisdictions/nl.json`, NL today)
64
+ - Remediation action plan: the report (terminal-adjacent Markdown + JSON
65
+ `actionPlan`) now includes a prioritised, owner-actionable plan, what, why,
66
+ how to fix, rough effort, and whether it's a code change or an owner action
67
+ (rotate a secret, renew a cert, change DNS), replacing the old generic
68
+ recommendations list. Built from a remediation knowledge base (`lib/remediation`)
69
+ - Agent Skill Workflow 5 + `references/reporting.md`: generate owner-facing
70
+ documents from a scan, a remediation plan, a prefilled security-questionnaire
71
+ response, and a NIS2 duty-of-care evidence summary, grounded in scan evidence,
72
+ with unbacked/organisational items marked `NEEDS HUMAN INPUT` (never fabricated)
73
+ - Email authentication probe (SPF, DMARC, MX via DNS), new `lib/blackbox/email-dns.js`,
74
+ runs in the standard profile for public domains. Flags missing/permissive SPF,
75
+ missing or monitoring-only (`p=none`) DMARC, and nudges DKIM verification. A
76
+ questionnaire staple that was previously uncovered
77
+ - `--framework nis2` compliance report mode: a per-scan NIS2 Article 21 coverage
78
+ table (which measures this scan actually exercised, driven by the probes that
79
+ ran) added to the terminal, Markdown, and JSON reports. Frameworks are
80
+ declarative so national transpositions and other regimes can be added as data
81
+ - NIS2 / cyberwetgeving compliance section in the README: Article 21(2)(a-j)
82
+ mapped to what Penthera actually tests, with a coverage key and a clear
83
+ "not legal advice / not a certification" disclaimer
84
+ - Code of Conduct (Contributor Covenant 2.1), issue templates, and PR template
85
+ - `tests/detection-hardening.test.js` covering the secret-scan and SSTI fixes
86
+
87
+ ### Fixed
88
+
89
+ - Interactive onboarding now attaches the remediation action plan to its report,
90
+ matching the main CLI path (the two had drifted)
91
+ - Audit-loop fingerprint no longer merges genuinely distinct findings. Collapsing
92
+ every digit run made different ciphers, TLS versions, library versions, API
93
+ versions, and per-CVE findings look like one item, which distorted the
94
+ measure-f numbers. It now collapses only numeric URL path segments and
95
+ separates dependency CVEs by description
96
+ - `updateHistory` no longer mutates the history object passed to it
97
+ - Jurisdiction data is loaded once instead of re-read per document
98
+ - Secret scanner no longer flags dummy/probe credentials (e.g. the
99
+ `invalid-password-12345` payload Penthera flagged on its own repo); rule
100
+ renamed so the title no longer reads "Password in source in source"
101
+ - SSTI probe uses a randomized arithmetic canary instead of `7*7=49`, removing
102
+ the critical false positive on any page containing "49"
103
+ - Endpoint calibration compares body length to body length (was body vs
104
+ Content-Length), so the noise filter actually filters default/404 pages
105
+ - WSTG coverage now reflects the probes that actually ran, instead of asserting
106
+ every profile probe was exercised; dropped two WSTG IDs that were mapped but
107
+ never tested (CRYP-02 padding oracle, CONF-13 path confusion)
108
+ - Login "accepts arbitrary credentials" no longer fires on a bare HTTP 200; it
109
+ requires an actual authenticated response (auth cookie or token) for the
110
+ invalid-credential attempt, so SPA logins that return 200 `{success:false}`
111
+ are no longer false-flagged
112
+ - Reflected XSS is only reported when the response is served as HTML; JSON/text
113
+ APIs that echo a payload are no longer flagged as XSS
114
+ - Removed the fuzzer's prototype-pollution false positive (it fired on any
115
+ object payload returning 200, because `payload.__proto__` is always truthy)
116
+ - Open-redirect false positives (found scanning a real Vercel-hosted site): the
117
+ OAuth and injection open-redirect probes now confirm the `Location` actually
118
+ resolves to the attacker's host, instead of substring-matching. A same-site
119
+ apex→www canonicalization that preserves the payload in the query is no longer
120
+ reported as an open redirect. Also removed the redundant, FP-prone
121
+ "open redirect via callback" built-in template
122
+ - Login hardening probe no longer runs against a path that returns a redirect
123
+ (3xx), 404, or 405, not a real login handler, removing a false "no login
124
+ rate limiting detected" on redirected paths
125
+
126
+ ### Changed
127
+
128
+ - Interactive wizard's remote-host permission prompt now defaults to **no**
129
+ - README shows the live CI status badge instead of a hand-written test count;
130
+ live integration tests report as skipped (not passed) without a running target
131
+ - Corrected the built-in template count (14, not 17) in docs and progress output
132
+
133
+ ## [1.0.0], 2026-06-30
134
+
135
+ First production-ready release.
136
+
137
+ ### Added
138
+
139
+ - PostHog-style interactive onboarding (`penthera` with no args, `penthera-scan`)
140
+ - Scan profiles: `quick`, `standard`, `deep`
141
+ - Markdown reports with OWASP WSTG coverage section
142
+ - Session-aware scanning (`--auth-cookie`, `--auth-bearer`, `PENTHERA_*` env)
143
+ - JWT, IDOR/BOLA, OAuth, client-side auth, and security header probes
144
+ - Secret scanning and Express/Hono/Fastify route discovery in repo mode
145
+ - Baseline diff mode (`--baseline`)
146
+ - Adaptive probe engine in CLI (`--adaptive`)
147
+ - Plugin/templates API (`--templates`, `lib/plugins.js`, programmatic exports)
148
+ - Agent Skill (`skills/penthera/`) with preflight and report validation scripts
149
+ - CI scan job with mock server, SARIF upload, and skill validation
150
+ - Staging URL workflow (`.github/workflows/scan.yml`)
151
+ - Docker image (`Dockerfile`)
152
+ - Documentation hub (`docs/index.md`, `docs/owasp-wstg-coverage.md`)
153
+
154
+ ### Fixed
155
+
156
+ - URL trailing-slash normalization (double-slash 404 bug)
157
+
158
+ ## [0.2.0], 2026-04
159
+
160
+ - Markdown reports, scan profiles, auth tooling, expanded API discovery
161
+
162
+ ## [0.1.x], 2026-04
163
+
164
+ - Initial CLI: URL, repo, and machine scan modes
165
+ - Built-in templates, TLS, CORS, SARIF export
166
+
167
+ [1.1.0]: https://github.com/danoszz/penthera/compare/v1.0.0...v1.1.0
168
+ [1.0.0]: https://github.com/danoszz/penthera/compare/v0.2.0...v1.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 daan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.