securl 1.4.1

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 +241 -0
  2. package/LICENSE +21 -0
  3. package/README.md +427 -0
  4. package/RELEASING.md +37 -0
  5. package/SECURITY.md +27 -0
  6. package/dist/certificate.d.ts +5 -0
  7. package/dist/certificate.js +92 -0
  8. package/dist/cli.d.ts +1 -0
  9. package/dist/cli.js +674 -0
  10. package/dist/compromiseSignals.d.ts +10 -0
  11. package/dist/compromiseSignals.js +183 -0
  12. package/dist/cookie-analysis.d.ts +2 -0
  13. package/dist/cookie-analysis.js +41 -0
  14. package/dist/cookieAnalysis.d.ts +2 -0
  15. package/dist/cookieAnalysis.js +82 -0
  16. package/dist/ctDiscovery.d.ts +19 -0
  17. package/dist/ctDiscovery.js +357 -0
  18. package/dist/domain-security.d.ts +10 -0
  19. package/dist/domain-security.js +416 -0
  20. package/dist/header-analysis.d.ts +14 -0
  21. package/dist/header-analysis.js +165 -0
  22. package/dist/historyDiff.d.ts +4 -0
  23. package/dist/historyDiff.js +117 -0
  24. package/dist/html-extraction.d.ts +12 -0
  25. package/dist/html-extraction.js +279 -0
  26. package/dist/html-page-analysis.d.ts +38 -0
  27. package/dist/html-page-analysis.js +459 -0
  28. package/dist/htmlInsights.d.ts +23 -0
  29. package/dist/htmlInsights.js +460 -0
  30. package/dist/identityProvider.d.ts +14 -0
  31. package/dist/identityProvider.js +259 -0
  32. package/dist/index.d.ts +17 -0
  33. package/dist/index.js +1008 -0
  34. package/dist/infrastructure.d.ts +9 -0
  35. package/dist/infrastructure.js +149 -0
  36. package/dist/libraryRisk.d.ts +3 -0
  37. package/dist/libraryRisk.js +164 -0
  38. package/dist/network-validation.d.ts +30 -0
  39. package/dist/network-validation.js +161 -0
  40. package/dist/network.d.ts +34 -0
  41. package/dist/network.js +139 -0
  42. package/dist/passive-intelligence.d.ts +21 -0
  43. package/dist/passive-intelligence.js +247 -0
  44. package/dist/path-discovery.d.ts +4 -0
  45. package/dist/path-discovery.js +50 -0
  46. package/dist/postureDigest.d.ts +142 -0
  47. package/dist/postureDigest.js +159 -0
  48. package/dist/postureDrift.d.ts +4 -0
  49. package/dist/postureDrift.js +118 -0
  50. package/dist/postureRemediation.d.ts +6 -0
  51. package/dist/postureRemediation.js +286 -0
  52. package/dist/redirectChain.d.ts +2 -0
  53. package/dist/redirectChain.js +39 -0
  54. package/dist/riskEvents.d.ts +3 -0
  55. package/dist/riskEvents.js +187 -0
  56. package/dist/scannerConfig.d.ts +49 -0
  57. package/dist/scannerConfig.js +79 -0
  58. package/dist/scoring.d.ts +32 -0
  59. package/dist/scoring.js +367 -0
  60. package/dist/security-txt.d.ts +4 -0
  61. package/dist/security-txt.js +123 -0
  62. package/dist/surfaceEnrichment.d.ts +44 -0
  63. package/dist/surfaceEnrichment.js +377 -0
  64. package/dist/technology-detection.d.ts +4 -0
  65. package/dist/technology-detection.js +93 -0
  66. package/dist/types.d.ts +730 -0
  67. package/dist/types.js +1 -0
  68. package/dist/utils.d.ts +7 -0
  69. package/dist/utils.js +66 -0
  70. package/dist/wafFingerprint.d.ts +5 -0
  71. package/dist/wafFingerprint.js +156 -0
  72. package/examples/risk-events.mjs +27 -0
  73. package/examples/scan-url.mjs +17 -0
  74. package/package.json +102 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,241 @@
1
+ # Changelog
2
+
3
+ All notable changes to `securl` will be documented in this file.
4
+
5
+ The format is based on Keep a Changelog and this package follows Semantic Versioning once published.
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [1.4.1] - 2026-06-14
10
+
11
+ ### Changed
12
+ - Refreshed package metadata and trust documentation after moving the source repository to `this-is-securl/securl`.
13
+
14
+ ## [1.4.0] - 2026-06-13
15
+
16
+ ### Added
17
+ - Added structured finding evidence references and a remediation plan builder for prioritized, owner-aware fix guidance.
18
+ - Added the `securl/remediation-plan` package export for clients that want to build fix plans from scan results.
19
+
20
+ ## [1.3.0] - 2026-06-11
21
+
22
+ ### Added
23
+ - Added posture drift reports that combine history diffs, risk events, severity counts, changed areas, and overall drift direction into one stable monitoring payload.
24
+ - Added the `securl/posture-drift` package export for clients building history, monitoring, or alerting workflows.
25
+
26
+ ## [1.2.1] - 2026-06-06
27
+
28
+ ### Changed
29
+ - Capped A-level posture grades when Domain & Trust is weak, so strong browser-facing headers no longer mask broad DNS, email, or public-trust gaps in quiet or standard scans.
30
+
31
+ ## [1.2.0] - 2026-06-04
32
+
33
+ ### Added
34
+ - Added `buildPostureDigest()` for producing compact, API/mobile-friendly summaries from full scan results.
35
+ - Added the `securl/posture-digest` package export for consumers that want the digest helper without importing the wider SDK surface.
36
+
37
+ ## [1.1.1] - 2026-06-02
38
+
39
+ ### Changed
40
+ - Refreshed npm package signalling with clearer CLI, CI, SDK, and monitoring examples for developer adoption.
41
+ - Expanded package keywords and shipped examples to make the engine easier to discover for posture, CI, and vendor-risk workflows.
42
+
43
+ ## [1.1.0] - 2026-06-01
44
+
45
+ ### Added
46
+ - Added posture risk event classification helpers for scan history diffs, including score, grade, certificate, security-header, WAF, CT-host, third-party, AI-vendor, identity-provider, and new critical-finding changes.
47
+ - Added the `securl/risk-events` package export for consumers that want to build monitoring or alerting workflows from scan comparisons.
48
+
49
+ ### Changed
50
+ - Added `currentGrade` to `HistoryDiff` so consumers can render grade movement without carrying a separate current snapshot.
51
+
52
+ ## [1.0.1] - 2026-05-30
53
+
54
+ ### Added
55
+ - Added passive public IOC and abuse indicators, including off-origin credential-form review signals, suspicious script markers, CT takeover evidence, exposure findings, and visible client-library advisory matches.
56
+
57
+ ## [1.0.0] - 2026-05-27
58
+
59
+ ### Added
60
+ - Added score driver metadata to analysis results so callers can explain the largest score deductions and limited-assessment caps.
61
+ - Added deterministic scoring calibration profiles and passive signature registry tests to protect launch-facing grade expectations.
62
+ - Added `deep-passive` scan mode for broader bounded CT sampling, crawl, exposure, and API-surface checks.
63
+
64
+ ### Changed
65
+ - Documented default, quiet, and deep-passive scan boundaries and CI policy modes more explicitly in CLI help and the package README.
66
+ - Hardened public-target validation coverage for normalized private IP literal forms, including IPv6-mapped loopback redirects.
67
+
68
+ ## [0.11.2] - 2026-05-24
69
+
70
+ ### Changed
71
+ - Replaced Cheerio with `node-html-parser` for passive HTML page analysis, reducing the core package dependency tree while preserving title, metadata, form, script, stylesheet, link, and SRI extraction behavior.
72
+
73
+ ## [0.11.1] - 2026-05-21
74
+
75
+ ### Changed
76
+ - Refreshed the npm package README and package metadata with clearer SecURL product positioning, hosted scanner links, and marketing site links.
77
+
78
+ ## [0.11.0] - 2026-05-20
79
+
80
+ ### Added
81
+ - Added redirect-chain analysis from the existing fetch flow, including mixed HTTP hops, long chains, and cross-domain final destination flags.
82
+ - Added aggregate cookie attribute analysis for `Secure`, `HttpOnly`, `SameSite`, session-cookie, `__Host-`, and `__Secure-` signals.
83
+ - Added DKIM common-selector discovery, deeper SPF mechanism analysis, and an email deliverability composite score.
84
+ - Added RFC 9116-oriented `security.txt` validation with valid, expired, incomplete, and missing states.
85
+ - Added Subresource Integrity coverage scoring for externally hosted scripts and stylesheets.
86
+ - Added passive framework/version leakage signals for common frontend frameworks and CMS markers found in fetched HTML.
87
+ - Added protocol and WAF summary fields to passive infrastructure analysis using response headers such as `Alt-Svc`, `cf-ray`, `x-iinfo`, and related edge signatures.
88
+
89
+ ## [0.10.0] - 2026-05-19
90
+
91
+ ### Added
92
+ - Added TLS-RPT DNS record detection to domain security analysis. Reports `_smtp._tls` records, flags missing TLS-RPT when MTA-STS is present, and exposes `tlsRpt` on the public `DomainSecurityInfo` type.
93
+ - Added BIMI DNS record detection (`default._bimi`) to domain security analysis, including detection of the BIMI `v=BIMI1` indicator and `bimi` on the public `DomainSecurityInfo` type.
94
+ - Added infrastructure provider detection for Bunny.net (CDN), Cloudflare Pages, Railway, Render, Fly.io, Hostinger, OVHcloud, and Hetzner.
95
+ - Added analytics and session-replay vendor detection for Plausible, Matomo, Segment, Mixpanel, Amplitude, Heap, Microsoft Clarity, LogRocket, Pendo, New Relic Browser, and Datadog RUM.
96
+ - Promoted analytics/telemetry and session-replay/experience-analytics to explicit third-party risk categories in HTML passive analysis.
97
+
98
+ ## [0.9.0] - 2026-05-17
99
+
100
+ ### Added
101
+ - Added `passiveIntelligence` to the public analysis result model, summarizing passive stack, infrastructure, telemetry, third-party, AI, trust, email, and exposure signals.
102
+ - Added a strict passive-collection boundary statement so downstream consumers can distinguish public-response intelligence from aggressive reconnaissance.
103
+ - Added deterministic core coverage for passive intelligence summaries and boundary wording.
104
+
105
+ ### Changed
106
+ - Exposed passive intelligence through hosted scan evidence payloads for API clients and future report/export consumers.
107
+
108
+ ## [0.8.2] - 2026-05-14
109
+
110
+ ### Added
111
+ - Added optional scan timing metadata for total, core, and enrichment phases so callers can understand slow or partial scans.
112
+ - Added a configurable maximum scan duration option for callers that need bounded execution.
113
+
114
+ ### Changed
115
+ - Bounded secondary enrichment so long-running scans return a partial timed-out posture result instead of hanging indefinitely.
116
+ - Tightened network and runtime safety around redirects, request failures, memory usage, and Node.js runtime support.
117
+ - Refined passive DNS, certificate-transparency, and secondary probe handling to reduce latency spikes while preserving useful evidence.
118
+
119
+ ## [0.8.1] - 2026-05-07
120
+
121
+ ### Changed
122
+ - Refined posture scoring so hosted-platform app URLs take a softer domain-trust penalty when the target is clearly a demo or PaaS-hosted surface rather than an owned apex domain.
123
+ - Recalibrated `AI & Automation` posture scoring so absent visible AI surface is treated as low exposure rather than perfect assurance.
124
+ - Improved surface-enrichment handling for SPA frontend fallbacks so successful responses on paths like `/.git/HEAD` or `/.env` are no longer misreported as exposed sensitive files when they clearly return the standard app shell.
125
+ - Simplified and modularized the core scan pipeline internals so scoring, enrichment, and summary assembly are easier to evolve without changing the public API.
126
+ - Expanded deterministic coverage for scoring calibration and frontend-fallback exposure detection.
127
+
128
+ ## [0.8.0] - 2026-04-29
129
+
130
+ ### Added
131
+ - Added structured limited-read handling for blocked, timeout, and TLS-validation failures so constrained scans return an explicit `U` posture result instead of crashing or overclaiming confidence.
132
+ - Added passive training or challenge-surface narrative detection so lab-style targets are called out in executive summaries without polluting posture scoring.
133
+ - Added `Client code signals` to summarize framework, vendor, API/config, and version-hint intelligence from visible client-side assets.
134
+
135
+ ### Changed
136
+ - Recalibrated posture scoring again so weak public targets spread more honestly across grades, with stronger penalties for missing browser-layer controls and breadth-of-weakness across categories.
137
+ - Tightened executive summary wording so browser hardening, transport/access limits, and constrained reads drive the main visible risk more consistently.
138
+ - Cleaned certificate-transparency fallback messaging so unreadable public-source responses produce calm narrative output instead of raw parser errors.
139
+ - Improved exposure and API probe handling so repeated server-side errors on sensitive or API-style paths are surfaced as review-worthy signals.
140
+ - Hardened the server boundary by making `/api/analyze` `GET`-only, returning minimal `/api/health` output in production, and degrading distributed rate limiting into a safer local fallback.
141
+ - Expanded deterministic coverage for scoring, CT fallback, and server hardening behavior.
142
+
143
+ ## [0.7.0] - 2026-04-25
144
+
145
+ ### Added
146
+ - Added the short `epi` CLI binary alias alongside `external-posture-insight`.
147
+ - Added lightweight interactive multi-target CLI progress on stderr while keeping stdout report output pipe-friendly.
148
+ - Added structured SPF and DMARC policy evaluation to `DomainSecurityInfo`, including SPF all-mechanism strength, DNS lookup-mechanism count, DMARC enforcement policy, rollout percentage, and reporting presence.
149
+ - Added `analyzeInfrastructure()` for passive cloud/CDN/edge/hosting inference from DNS, reverse DNS, headers, and detected technology evidence.
150
+ - Added `InfrastructureInfo` and related provider signal types to the public result model.
151
+ - Added deterministic core test coverage for infrastructure provider inference.
152
+ - Added quiet scan mode via `analyzeUrl(target, { scanMode: "quiet" })` and CLI `--quiet`.
153
+
154
+ ### Changed
155
+ - Treat HTTP 5xx target responses as limited availability reads and cap their posture grade below `C` so unavailable pages do not look like normal mixed posture results.
156
+ - Recalibrated `analyzeUrl()` scoring around weighted posture areas so the overall grade reflects domain/trust, exposure, API, third-party, and AI posture alongside core hardening controls.
157
+ - Added bounded concurrency for CT host sampling, OSV vulnerability detail lookups, and related-page crawl checks.
158
+ - Lazy-loaded Cheerio inside HTML analysis so importing the package is fast for CLI/help and workflows that do not parse page HTML.
159
+ - Clarified README safety wording, CLI quick-start examples, and package usage boundaries for public launch.
160
+
161
+ ## [0.6.1] - 2026-04-19
162
+
163
+ ### Changed
164
+ - Refreshed direct and transitive dependencies via Dependabot group update, including `react-router-dom` and multiple security-relevant parser/glob stack updates (`js-yaml`, `picomatch`, `brace-expansion`, `minimatch`, `glob`, `flatted`).
165
+ - Verified package build and test flows continue to pass after lockfile refresh.
166
+
167
+ ## [0.6.0] - 2026-04-16
168
+
169
+ ### Added
170
+ - CLI policy gating with `--fail-on info|warning|critical` for CI exit-code control.
171
+ - CLI regression policy mode with `--fail-on-regression` for baseline/compare workflows.
172
+ - Compact `ci-json` CLI output for scan/compare automation pipelines.
173
+ - CLI score-threshold gating with `--fail-if-score-below <0-100>`.
174
+ - Richer batch scan summaries in summary/Markdown output with aggregate score and strongest/weakest targets.
175
+
176
+ ### Changed
177
+ - Updated Vite toolchain compatibility to keep installs stable with current plugin peer dependencies.
178
+ - Hardened TLS certificate issuer/subject normalization for stricter TypeScript handling.
179
+ - Expanded CLI tests and help-surface assertions for policy mode usage.
180
+
181
+ ## [0.5.0] - 2026-04-16
182
+
183
+ ### Added
184
+ - CLI batch scanning via `scan <target...>` with summary, Markdown table, and JSON output support.
185
+ - CLI report-to-report comparison via `compare <current-report.json> <baseline-report.json>`.
186
+ - CLI SARIF output for both scans and comparisons, including compare mode output focused on newly introduced findings.
187
+ - Core CLI test coverage for comparison workflows, JSON/SARIF output, malformed baseline handling, and invalid baseline usage in multi-target scans.
188
+
189
+ ### Changed
190
+ - Expanded CLI help and package README examples/documentation to cover batch scans, direct comparisons, and SARIF output.
191
+ - Improved CLI argument parsing to support command-oriented workflows while keeping baseline comparisons scoped to single-target scans.
192
+
193
+ ## [0.4.0] - 2026-04-09
194
+
195
+ ### Added
196
+ - Passive library risk detection from explicitly versioned script URLs with OSV-backed advisory lookups.
197
+ - Score trending in the monitoring UI and a shared history-diff model exported from the core package.
198
+ - CLI baseline comparison support via `--baseline <report.json>`.
199
+ - Passive DNSSEC posture and certificate-transparency takeover clues from sampled CNAME evidence.
200
+
201
+ ### Changed
202
+ - Hardened scan dispatch with stricter public-target revalidation on outbound requests.
203
+ - Added explicit timeout handling around OIDC discovery and improved hosted-mode server boundary controls.
204
+ - Versioned browser-local monitoring storage and surfaced clearer target-cap feedback in the app.
205
+ - Unified app and package diff logic so monitoring and CLI comparisons use the same change model.
206
+
207
+ ## [0.3.0] - 2026-04-08
208
+
209
+ ### Added
210
+ - A first-class CLI entrypoint with `scan`, summary/JSON/Markdown output, and file output support.
211
+ - Richer monitoring diffs covering certificate windows, third-party providers, AI vendors, identity-provider changes, WAF changes, and CT priority-host changes.
212
+ - WAF and edge fingerprinting with passive provider inference.
213
+ - Certificate Transparency coverage rollups with prioritized and sampled hosts.
214
+
215
+ ### Changed
216
+ - Deepened passive identity discovery with stronger OAuth/OIDC heuristics and less eager same-origin redirect attribution.
217
+ - Improved passive-signal messaging and UI consistency for identity, CT, third-party trust, and disclosure/domain trust panels.
218
+ - Consolidated duplicated core helpers and documented scanner limits in shared config.
219
+
220
+ ## [0.2.0] - 2026-04-07
221
+
222
+ ### Added
223
+ - Passive Identity Provider and OAuth discovery, including public OpenID configuration checks.
224
+ - Certificate Transparency discovery with bounded, best-effort lookup behavior.
225
+ - Staged strict TypeScript verification for extracted core modules.
226
+ - Dependabot configuration and npm publish provenance support for release hygiene.
227
+
228
+ ### Changed
229
+ - Replaced regex-driven HTML parsing with a Cheerio-based DOM inspection path.
230
+ - Extracted CT, identity, HTML insight, and surface-enrichment logic out of the core scanner monolith.
231
+ - Hardened the local server boundary with request validation, basic rate limiting, and safer API error responses.
232
+ - Added package `engines` metadata and simplified the repo to a single npm lockfile story.
233
+
234
+ ## [0.1.0] - 2026-04-05
235
+
236
+ ### Added
237
+ - Initial extracted scanner core package.
238
+ - Passive HTML/client exposure analysis.
239
+ - AI surface, third-party trust, DNS/mail posture, exposure, and API-surface analysis.
240
+ - OWASP/MITRE-aligned finding labeling.
241
+ - Regression fixtures for known false positives.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Keith Batterham
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.
package/README.md ADDED
@@ -0,0 +1,427 @@
1
+ # securl
2
+
3
+ [![npm version](https://img.shields.io/npm/v/securl)](https://www.npmjs.com/package/securl)
4
+ [![npm package](https://img.shields.io/badge/npm-package-red)](https://www.npmjs.com/package/securl)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
6
+ [![SecURL package checks](https://github.com/this-is-securl/securl/actions/workflows/core-package-checks.yml/badge.svg)](https://github.com/this-is-securl/securl/actions/workflows/core-package-checks.yml)
7
+
8
+ **The passive security posture engine behind SecURL.**
9
+
10
+ `securl` is the reusable scanner engine behind [SecURL](https://securl.online), a posture-first external security review tool for public web targets.
11
+
12
+ It is designed for passive, low-noise assessment rather than active exploitation or broad reconnaissance. The engine turns public web signals into structured JSON, Markdown, SARIF, and CI-friendly output.
13
+
14
+ Use it when you need a fast outside-in read on a public web service:
15
+
16
+ - run a security posture smoke check in CI before release
17
+ - generate JSON or SARIF evidence for internal review
18
+ - compare the current posture against a saved baseline
19
+ - classify monitoring changes into risk events for alerts or dashboards
20
+ - enrich vendor, supplier, or customer domain reviews without credentials or agents
21
+
22
+ <p>
23
+ <a href="https://securl.online"><strong>Visit the SecURL site</strong></a>
24
+ ·
25
+ <a href="https://app.securl.online"><strong>Try the live scanner</strong></a>
26
+ ·
27
+ <a href="https://apps.apple.com/app/securl/id6774322464"><strong>Get the iOS app</strong></a>
28
+ ·
29
+ <a href="https://github.com/this-is-securl/securl"><strong>View the source</strong></a>
30
+ </p>
31
+
32
+ ## Quick Start
33
+
34
+ Run a scan without installing:
35
+
36
+ ```bash
37
+ npx securl scan example.com
38
+ ```
39
+
40
+ Install globally for the `securl` command:
41
+
42
+ ```bash
43
+ npm install -g securl
44
+ securl scan example.com
45
+ ```
46
+
47
+ Prefer the hosted report workspace? Use [app.securl.online](https://app.securl.online). For the product overview, start at [securl.online](https://securl.online). Prefer mobile? Install [SecURL on the App Store](https://apps.apple.com/app/securl/id6774322464).
48
+
49
+ ## Common use cases
50
+
51
+ ### 1. Quick CLI posture check
52
+
53
+ ```bash
54
+ npx securl scan https://example.com --format summary
55
+ ```
56
+
57
+ Example summary output:
58
+
59
+ ```text
60
+ example.com A 93/100 2 findings
61
+ ```
62
+
63
+ ### 2. CI gate for public-facing deployments
64
+
65
+ Fail the job when a target drops below a minimum score or introduces warning-level findings:
66
+
67
+ ```bash
68
+ npx securl scan https://example.com \
69
+ --quiet \
70
+ --format ci-json \
71
+ --fail-if-score-below 75 \
72
+ --fail-on warning
73
+ ```
74
+
75
+ Compare a new scan with a saved baseline:
76
+
77
+ ```bash
78
+ npx securl scan https://example.com \
79
+ --baseline ./security-baseline.json \
80
+ --fail-on-regression
81
+ ```
82
+
83
+ ### 3. Node.js SDK scan
84
+
85
+ ```js
86
+ import { analyzeUrl } from "securl";
87
+
88
+ const result = await analyzeUrl("https://example.com", {
89
+ scanMode: "quiet",
90
+ });
91
+
92
+ console.log({
93
+ score: result.score,
94
+ grade: result.grade,
95
+ mainRisk: result.executiveSummary.mainRisk,
96
+ findings: result.issues.map((issue) => ({
97
+ severity: issue.severity,
98
+ title: issue.title,
99
+ })),
100
+ });
101
+ ```
102
+
103
+ ### 4. Monitoring and risk-event classification
104
+
105
+ Version `1.1.0+` includes helpers for turning two scan snapshots into alert-friendly posture events.
106
+
107
+ ```js
108
+ import {
109
+ buildHistoryDiffFromSnapshots,
110
+ snapshotFromAnalysis,
111
+ } from "securl/history-diff";
112
+ import {
113
+ buildPostureRiskEventsFromSnapshots,
114
+ } from "securl/risk-events";
115
+
116
+ const currentSnapshot = snapshotFromAnalysis(currentReport);
117
+ const previousSnapshot = snapshotFromAnalysis(previousReport);
118
+ const diff = buildHistoryDiffFromSnapshots(currentSnapshot, previousSnapshot);
119
+ const riskEvents = buildPostureRiskEventsFromSnapshots(
120
+ currentSnapshot,
121
+ previousSnapshot,
122
+ diff,
123
+ );
124
+
125
+ console.log(riskEvents);
126
+ ```
127
+
128
+ Risk events include score regressions, grade drops, new critical findings, certificates nearing expiry, security header regressions, WAF signal removals, new CT priority hosts, identity-provider changes, and new third-party or AI vendors.
129
+
130
+ Version `1.3.0+` also includes a higher-level posture drift report for monitoring and alerting surfaces that need one stable payload with the diff, risk events, changed areas, severity counts, and an overall direction.
131
+
132
+ ```js
133
+ import {
134
+ buildPostureDriftReportFromSnapshots,
135
+ } from "securl/posture-drift";
136
+
137
+ const drift = buildPostureDriftReportFromSnapshots(
138
+ currentSnapshot,
139
+ previousSnapshot,
140
+ );
141
+
142
+ console.log(drift.summary.direction, drift.summary.changedAreas);
143
+ ```
144
+
145
+ Runnable examples are included in [`examples/`](./examples):
146
+
147
+ ```bash
148
+ node examples/scan-url.mjs https://example.com
149
+ node examples/risk-events.mjs current-report.json previous-report.json
150
+ ```
151
+
152
+ ### 5. Compact posture digest for APIs and mobile clients
153
+
154
+ Version `1.2.0+` includes a digest helper for turning a full scan result into a smaller, stable summary payload.
155
+
156
+ ```js
157
+ import { analyzeUrl } from "securl";
158
+ import { buildPostureDigest } from "securl/posture-digest";
159
+
160
+ const result = await analyzeUrl("https://example.com", {
161
+ scanMode: "quiet",
162
+ });
163
+
164
+ const digest = buildPostureDigest(result);
165
+
166
+ console.log({
167
+ grade: digest.posture.grade,
168
+ score: digest.posture.score,
169
+ topFindings: digest.findings.top,
170
+ topFixes: digest.remediationPlan?.topActions,
171
+ riskIndicators: digest.intelligence.riskIndicators,
172
+ });
173
+ ```
174
+
175
+ ### 6. Evidence-backed remediation plans
176
+
177
+ Version `1.4.0+` includes a remediation plan helper that turns score drivers and findings into prioritized, owner-aware fix guidance. Findings can also carry structured evidence references so clients can show why a finding was raised.
178
+
179
+ ```js
180
+ import {
181
+ attachIssueEvidence,
182
+ buildPostureRemediationPlan,
183
+ } from "securl/remediation-plan";
184
+
185
+ const resultWithEvidence = attachIssueEvidence(result);
186
+ const remediationPlan = buildPostureRemediationPlan(resultWithEvidence);
187
+
188
+ console.log(remediationPlan.items.map((item) => ({
189
+ title: item.title,
190
+ owner: item.owner,
191
+ impact: item.impact,
192
+ action: item.action,
193
+ })));
194
+ ```
195
+
196
+ ## Package trust and release signals
197
+
198
+ - public source repository with package code under `packages/core`
199
+ - npm publishing from GitHub Actions with provenance enabled
200
+ - CI checks covering audit, build, lint, tests, and dry-run packaging
201
+ - no install scripts
202
+ - one runtime dependency (`node-html-parser`)
203
+ - published MIT license, changelog, release notes, and security policy
204
+
205
+ Security disclosure guidance:
206
+
207
+ - [`packages/core/SECURITY.md`](./SECURITY.md)
208
+ - [`/SECURITY.md`](../../SECURITY.md)
209
+
210
+ ## Safety model
211
+
212
+ SecURL is passive-first and production-conscious, but it is not magic invisibility dust. A standard scan may make DNS queries, perform TLS handshakes, fetch the target page, follow redirects, query third-party public datasets such as Certificate Transparency / OSV, and run a small set of low-noise HTTP checks. It does not attempt exploitation, brute forcing, authentication bypass, form submission, fuzzing, password testing, or vulnerability exploitation.
213
+
214
+ Use it only against systems you own or are authorized to assess. Results are heuristic and should be treated as decision support, not a formal penetration test or compliance attestation.
215
+
216
+ ## What it covers
217
+
218
+ - HTTP security headers and redirect posture
219
+ - TLS and certificate inspection
220
+ - Cookie hygiene
221
+ - Passive HTML inspection
222
+ - Passive public IOC and abuse indicators for suspicious scripts, off-origin credential flows, exposed paths, CT takeover clues, and visible vulnerable client libraries
223
+ - AI surface and third-party trust signals
224
+ - Low-noise exposure, CORS, API-surface, and DNS/mail posture checks
225
+ - OWASP/MITRE-aligned finding labels
226
+
227
+ ## Current status
228
+
229
+ This package is published and consumable from npm:
230
+
231
+ - [`securl`](https://www.npmjs.com/package/securl)
232
+ - Product site: [securl.online](https://securl.online)
233
+ - Live scanner: [app.securl.online](https://app.securl.online)
234
+ - iOS app: [SecURL on the App Store](https://apps.apple.com/app/securl/id6774322464)
235
+
236
+ It is also used by the SecURL app from the local workspace during development.
237
+
238
+ ## Release workflow
239
+
240
+ - local package check: `npm run pack:core`
241
+ - CI verification: `.github/workflows/core-package-checks.yml`
242
+ - publish workflow: `.github/workflows/publish-core-package.yml`
243
+ - publish requires an `NPM_TOKEN` repository secret
244
+ - publish uses npm provenance (`npm publish --provenance`)
245
+
246
+ Recommended release flow:
247
+
248
+ 1. update the version in `packages/core/package.json`
249
+ 2. run `npm run test:core`
250
+ 3. run `npm run pack:core`
251
+ 4. create and push a tag like `securl-v1.4.1`
252
+ 5. let the publish workflow release the package
253
+
254
+ See also:
255
+
256
+ - `packages/core/CHANGELOG.md`
257
+ - `packages/core/RELEASING.md`
258
+
259
+ ## Public API
260
+
261
+ Primary exports:
262
+
263
+ - `analyzeUrl(url, options)` - scan a public target and return a structured posture result.
264
+ - `analyzeTarget(url, options)` - compatibility alias for `analyzeUrl`.
265
+ - `analyzeHtmlDocument(url, html)` - run passive HTML/content analysis against already-fetched markup.
266
+ - `snapshotFromAnalysis(result)` - reduce a scan result to a comparison snapshot.
267
+ - `buildHistoryDiffFromSnapshots(current, previous)` - build a structured diff between scans.
268
+ - `buildPostureRiskEventsFromSnapshots(current, previous, diff)` - classify scan changes into alert-friendly risk events.
269
+ - `buildPostureDigest(result)` - reduce a full scan result to a compact API/mobile-friendly digest.
270
+ - `buildPostureDriftReportFromSnapshots(current, previous)` - produce a complete scan-to-scan drift report for monitoring, alerting, and history views.
271
+ - `buildPostureRemediationPlan(result)` - generate prioritized, owner-aware remediation actions from findings and score drivers.
272
+ - `attachIssueEvidence(result)` - add structured evidence references to findings without changing their existing fields.
273
+
274
+ Package subpath exports:
275
+
276
+ - `securl/history-diff`
277
+ - `securl/posture-digest`
278
+ - `securl/posture-drift`
279
+ - `securl/remediation-plan`
280
+ - `securl/risk-events`
281
+ - `securl/types`
282
+
283
+ ## CLI
284
+
285
+ The package includes a pipe-friendly CLI:
286
+
287
+ Scan multiple targets in one run:
288
+
289
+ ```bash
290
+ npx securl scan example.com github.com bbc.co.uk
291
+ securl scan example.com github.com bbc.co.uk
292
+ ```
293
+
294
+ Available output formats:
295
+
296
+ ```bash
297
+ npx securl scan example.com --format summary
298
+ npx securl scan example.com --format json
299
+ npx securl scan example.com --format markdown
300
+ npx securl scan example.com --format sarif
301
+ npx securl scan example.com --format ci-json
302
+ ```
303
+
304
+ The CLI writes machine-readable report output to stdout, and lightweight multi-target progress to stderr only when running interactively. This keeps JSON/SARIF output pipe-friendly.
305
+
306
+ Scan modes:
307
+
308
+ ```bash
309
+ npx securl scan example.com
310
+ npx securl scan example.com --quiet
311
+ npx securl scan example.com --deep-passive
312
+ ```
313
+
314
+ - default scan: primary response plus bounded passive enrichment, including HTML, DNS/mail, Certificate Transparency, OSV, exposure, CORS, API-surface, and public trust signals.
315
+ - `--quiet`: keeps primary response, TLS, headers, cookies, redirects, DNS/mail, Certificate Transparency summary, infrastructure, and public trust checks; skips page-body analysis, related-page crawl, security.txt fetch, identity discovery, exposure probes, CORS probes, API probes, OSV lookups, and CT host sampling. Use this for lower-noise CI smoke checks or frequent regression monitoring.
316
+ - `--deep-passive`: expands passive CT host sampling, related-page crawl, exposure probes, and API-surface probes while keeping request counts and scan duration bounded. Use this for pre-release or scheduled posture reviews where a broader passive pass is worth the extra time.
317
+
318
+ CI policy modes:
319
+
320
+ ```bash
321
+ npx securl scan example.com github.com --fail-on warning
322
+ npx securl scan example.com --baseline previous-report.json --fail-on-regression
323
+ npx securl scan example.com github.com --fail-if-score-below 75
324
+ npx securl compare current-report.json baseline-report.json --fail-on critical --fail-on-regression
325
+ ```
326
+
327
+ - `--fail-on` sets exit code `1` when findings at or above the selected severity are present.
328
+ - `--fail-on-regression` sets exit code `1` when the baseline comparison detects a regression (score drop, new issues, or worse HTTP status class).
329
+ - `--fail-if-score-below` sets exit code `1` when any scanned target score is below the given threshold.
330
+
331
+ Write results to a file:
332
+
333
+ ```bash
334
+ npx securl scan example.com --format json --output report.json
335
+ ```
336
+
337
+ Compare against a previously saved JSON report:
338
+
339
+ ```bash
340
+ npx securl scan example.com --baseline previous-report.json
341
+ ```
342
+
343
+ Compare two saved reports directly:
344
+
345
+ ```bash
346
+ npx securl compare current-report.json baseline-report.json
347
+ npx securl compare current-report.json baseline-report.json --format sarif
348
+ ```
349
+
350
+ Batch scans return:
351
+
352
+ - summary: one line per target
353
+ - markdown: a compact comparison table
354
+ - sarif: one SARIF log containing findings across all scanned targets
355
+ - ci-json: compact machine-readable output with policy pass/fail status
356
+ - json:
357
+
358
+ ```json
359
+ {
360
+ "analyses": [{ "...": "scan result" }]
361
+ }
362
+ ```
363
+
364
+ Direct report comparison returns:
365
+
366
+ - summary: score, status, and change summary
367
+ - markdown: a compact comparison report
368
+ - sarif: only findings that are newly introduced in the current report versus the baseline
369
+ - ci-json: compact machine-readable output with policy pass/fail status and diff details
370
+ - json:
371
+
372
+ ```json
373
+ {
374
+ "current": { "...": "latest saved report" },
375
+ "baseline": { "...": "older saved report" },
376
+ "diff": { "...": "structured change summary" }
377
+ }
378
+ ```
379
+
380
+ Show usage:
381
+
382
+ ```bash
383
+ npx securl --help
384
+ ```
385
+
386
+ ### `analyzeUrl(url)`
387
+
388
+ Run a full posture analysis for a public target.
389
+
390
+ ```js
391
+ import { analyzeUrl } from "securl";
392
+
393
+ const result = await analyzeUrl("https://example.com");
394
+ console.log(result.score, result.grade);
395
+ ```
396
+
397
+ `analyzeTarget` remains available as a compatibility alias, but `analyzeUrl` is the primary public entrypoint.
398
+
399
+ `analyzeUrl("https://example.com", { scanMode: "quiet" })` uses the same quiet boundary as CLI `--quiet`. `analyzeUrl("https://example.com", { scanMode: "deep-passive" })` uses the expanded passive recon boundary as CLI `--deep-passive`.
400
+
401
+ When a baseline report is supplied to the CLI, summary and Markdown output append a `Changes Since Baseline` section. JSON output returns:
402
+
403
+ ```json
404
+ {
405
+ "analysis": { "...": "latest scan result" },
406
+ "diff": { "...": "structured change summary" }
407
+ }
408
+ ```
409
+
410
+ ### `analyzeHtmlDocument(url, html)`
411
+
412
+ Run passive HTML/content analysis against a fetched HTML document.
413
+
414
+ ```js
415
+ import { analyzeHtmlDocument } from "securl";
416
+
417
+ const htmlSecurity = analyzeHtmlDocument("https://example.com", "<html>...</html>");
418
+ console.log(htmlSecurity.clientExposureSignals);
419
+ ```
420
+
421
+ ## Notes
422
+
423
+ - Only use this against targets you are authorized to assess.
424
+ - The package is intentionally conservative about active probing.
425
+ - Default scans perform bounded passive enrichment; quiet scans skip page-body and probe-heavy enrichment to keep request volume lower.
426
+ - Scoring is heuristic and should be treated as a prioritization aid, not an absolute security truth.
427
+ - The author is not responsible for misuse, unauthorized scanning, operational impact, or decisions made from the output without appropriate validation.