Repository navigation
feat(rules): add security.txt and version-disclosure rules (#713) - #717
Conversation
|
Review of #717 (security/security-txt and security/version-disclosure). I read the diff and the rule sources. I did not run the tests. The two rules are cleanly structured. The catch-all HTML handling and the truncated-excerpt downgrade to info are well thought out. The header plumbing (fetcher → crawler → adapter) is consistent, and the new header fields are optional so older records still load. I found nothing that should block merge.
|
Maintainer review (2026-10-12)Verdict: needs fixes (low to medium). Reviewed at head c72c8fd against main 2dca3b9. Main CI is green at that sha, so the red checks come from this PR. Acceptance criteria (#713)All 7 are met by unit tests in Fixes
PR hygiene
Merge orderThird, after #714 and #718, and before #716. #716 conflicts with this PR in |
Auto-review did not completeThe
Partial findings recovered from the session (incomplete, unverified, and NOT a merge signal): Show partial reviewYou've hit your session limit · resets 10:10pm (UTC) |
Adds two passive security rules: - security/security-txt checks /.well-known/security.txt (RFC 9116) and the legacy /security.txt. A catch-all HTML page at the canonical path warns rather than passes. Contact and a future Expires are required; Expires must be a strict RFC 3339 date-time (Date.parse alone took `2027` and rolled `2027-02-30` over), and a second Expires warns. Only 404 and 410 read as missing: a 401/403 (often a WAF), 429 or 5xx is not checked. An unsigned file and a legacy-only location are informational. - security/version-disclosure warns when Server, X-Powered-By, X-AspNet-Version, X-AspNetMvc-Version or X-Generator carries a dotted version number. One finding per distinct value, its pages in a Set and in the standard item sourcePages; the value is cut at 120 characters in the message. Page records stored before the four new headers were recorded do not pass: the rule says they were not checked (Server is still judged). The page header map now forwards X-Powered-By, X-AspNet-Version, X-AspNetMvc-Version and X-Generator to rules, which previously saw only server. The fetcher and crawler store them on the page record (null when not sent); the field is optional, so existing stored records still load, and SiteData pages carry versionHeadersRecorded so the rule can tell the two apart on both engines. Both security.txt paths join the well-known probe sweep, which requests the audited host only. The rule-exclude and discovery-probe contracts now expect them when ax is excluded, because the security rule reads them. Golden gate: 101738 -> 101740 findings and 303 -> 305 tally rows on main with #703 and #706 (security-txt info: no discovery probes in the harness; version-disclosure skipped: the synthetic records predate the headers); healthScore.overall stays 51. Signed-off-by: Nik Cubrilovic <[email protected]>
d5769a8 to
d0984bb
Compare
|
Reviewed the diff (rules, header passthrough, adapter, tests, docs). I found no blocking issues. The design is careful: the catch-all HTML trap, 404/410-only missing, the truncated-excerpt downgrade to info, strict RFC 3339 parsing and the old-record 'unrecorded' path all look right. I did not run the tests.
|
Summary
Adds two passive security rules and the header passthrough they need.
security/security-txtreads/.well-known/security.txt(RFC 9116) and the legacy/security.txt.ContactorExpiresmissing: warn.Expiresin the past, or not a strict RFC 3339 date-time (2027,Oct 1 2027,2027-02-30T...all warn): warn. More than oneExpires: warn.Expirespasses.security/version-disclosurewarns whenServer,X-Powered-By,X-AspNet-Version,X-AspNetMvc-VersionorX-Generatorcarries a dotted version (at least major.minor). A product name with no version (nginx,cloudflare) and a single number (Drupal 9) are not reported. One finding per distinct header value across the site, its pages in the standard itemsourcePages(collected in aSet); the value is cut at 120 characters in the message and kept whole invalue. Page records stored before the four new headers were recorded (a cached or older crawl) do not pass: aversion-disclosure-unrecordedcheck says they were not checked, and a versionedServeris still reported.SiteDatapages carryversionHeadersRecordedfor this, set the same way on both engines.buildHeadersMapnow forwards the four version-revealing headers to rules, which previously saw onlyserver. They are stored on the page record as optional fields, so existing stored records still load. No SQLite schema change: headers are stored as JSON.docs/rules/security/, wired into the Security nav and index.Cost note: both
security.txtpaths join the well-known probe sweep, so an audit that runs the security rules sends two extra GETs per origin (the canonical path and the legacy path).The discovery-probe contracts changed as a result.
--rule-exclude axandax/*now send the twosecurity.txtprobes, because the security rule reads them. Those expectations were updated, and the plugin probe test now also excludessecurity/*so it still isolates the plugin's probe.Changes from the maintainer review (2026-10-12):
streaming-rules-canonical-golden.test.ts101738 -> 101740 findings and 303 -> 305 tally rows, with comments; both tally rows are pinned (security-txt info: the harness sends no discovery probes; version-disclosure skipped: the synthetic records predate the headers).healthScore.overallstays 51.{header} header reveals a software version: {value}and describe the status, RFC 3339, duplicate and older-crawl behaviour.sourcePages, aSetper finding, not-checked on older records.Expires; duplicateExpireswarns; the quotedExpiresis capped.isHtmlformatted; CHANGELOG line under[Unreleased]/### Added.security.txtpaths join the existing well-known probe sweep, which requests the audited host only (its existing custom-header and redirect handling applies), and version-disclosure only reads stored headers.Agent skill: yes, the squirrelscan agent skill (squirrelscan/skills) should learn the two rules; the maintainer files that as a private issue. Per-category counts (Security +2) are left for the maintainer's batched docs PR.
Closes #713
Verification
The rule and test files are oxfmt- and oxlint-clean (the rules package has no format or lint script of its own).
No end-to-end crawl was run against a live or fixture site. The acceptance fixtures are unit tests that feed the rule the probe and header data a crawl would produce.
Acceptance criteria
/.well-known/security.txtproduces asecurity/security-txtwarning (unit test)/.well-known/security.txtwith its HTML homepage produces the same warning, not a pass (unit test)Contact:and a futureExpires:passes; anExpires:in the past warns (unit test)Server: Apache/2.4.41 (Ubuntu)andX-Powered-By: PHP/7.4.3each produce asecurity/version-disclosurewarning naming the header and value (unit test)Server: nginxwith no version produces no finding (unit test)X-Powered-Byand the ASP.NET version headers reach rules alongsideserver(build-headers-maptest)docs/rules/security/Checklist
Signed-off-byline (git commit -s).