Repository navigation
fix: eliminate false positives from severity inflation, CDN headers, HSTS correlation - #17
Conversation
…and HSTS correlation Finding.of() was silently replacing each module's severity with Severity.fromScore(cvss), causing INFO findings to appear as MEDIUM (Headers CWE-693 CVSS 5.4) and CRITICAL/HIGH findings to deflate to LOW (HSTS CWE-319 CVSS 3.1). The factory now honors the passed severity so each module controls its own risk rating. HeadersModule no longer flags CDN/WAF/proxy Server headers (cloudflare, akamai, fastly, etc.) as technology disclosure -- these are edge-injected, not controllable by the origin, and the recommendation to remove them was not actionable. HSTSModule now runs the HTTPS probe first; the "HTTP accessible -- SSLstrip" finding is suppressed when HSTS is present with adequate max-age, since SSLstrip is mitigated after the first visit. Aligned severity values in OpenRedirect (HIGH->MEDIUM), CRLF (CRITICAL->MEDIUM), CachePoisoning (CRITICAL->HIGH), and XSS reflected (HIGH->CRITICAL) to match their CVSS profiles -- these modules passed aspirational values that were always overridden.
Semgrep Static Analysis
✅ No issues found. |
SpotBugs + FindSecBugs
✅ No high-priority issues. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
| Duplication | 12 |
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
Security Scan Summary
✅ All security checks passed! |
There was a problem hiding this comment.
Pull Request Overview
The reflected-XSS finding is assigned CRITICAL while the detection log still reports HIGH, reintroducing severity inflation and contradicting the stated calibration goal. This should be corrected before merging.
No regression tests or coverage data were included, so the acceptance criteria around severity preservation, CDN handling, HSTS correlation, and non-CDN disclosure remain unverified. The CDN classification should also avoid suppressing unrelated headers that merely contain a known token.
Test suggestions
- Verify both Finding.of overloads preserve the caller-provided severity rather than deriving it from CVSS.
- Verify CDN/WAF Server values are recognized for WAF handling and are excluded from Server technology-disclosure findings.
- Verify a non-CDN Server value still generates a technology-disclosure finding.
- Verify the HTTP downgrade finding is suppressed when HTTPS HSTS max-age is at least one year.
- Verify the HTTP downgrade finding remains present when HSTS is absent or below the threshold.
- Verify the adjusted severities for OpenRedirect, CRLF, CachePoisoning, and reflected XSS.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify both Finding.of overloads preserve the caller-provided severity rather than deriving it from CVSS.
2. Verify CDN/WAF Server values are recognized for WAF handling and are excluded from Server technology-disclosure findings.
3. Verify a non-CDN Server value still generates a technology-disclosure finding.
4. Verify the HTTP downgrade finding is suppressed when HTTPS HSTS max-age is at least one year.
5. Verify the HTTP downgrade finding remains present when HSTS is absent or below the threshold.
6. Verify the adjusted severities for OpenRedirect, CRLF, CachePoisoning, and reflected XSS.
Low confidence findings
- Add automated regression coverage for the changed severity, header-classification, and HSTS-correlation paths. Ensure CDN/WAF matching is token-aware or exact enough that unrelated Server values are not suppressed.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| log.accept("[!!] XSS HIGH: '" + htmlPayload + "' refletido sem encoding em " + endpoint); | ||
| local.add(Finding.of(id(), endpoint, "Reflected XSS -- Payload Executável Refletido", | ||
| Severity.HIGH, | ||
| Severity.CRITICAL, |
There was a problem hiding this comment.
🔴 HIGH RISK
Keep the confirmed reflected-XSS finding at HIGH to align with the detection/log severity and avoid reintroducing severity inflation.
Suggested change:
| Severity.CRITICAL, | |
| Severity.HIGH, |
TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.
|
Re: Codacy XSS severity suggestion -- Dismissing. CVSS for XSS is 9.3 (CRITICAL) and the test at ScanHarnessTest:2099 asserts |
SpotBugs + FindSecBugs
✅ No high-priority issues. |
Semgrep Static Analysis
✅ No issues found. |
Security Scan Summary
✅ All security checks passed! |
- Finding.of preserves caller severity (both overloads) - CDN Server header (cloudflare) suppressed, non-CDN (nginx) reported - HSTS HTTP downgrade suppressed with adequate max-age - HSTS HTTP downgrade present when HSTS absent
Semgrep Static Analysis
✅ No issues found. |
SpotBugs + FindSecBugs
✅ No high-priority issues. |
Security Scan Summary
✅ All security checks passed! |
Summary
Severity.fromScore(cvss), inflating INFO findings to MEDIUM (Headers) and deflating CRITICAL/HIGH to LOW (HSTS). Modules now control their own severity.Server: cloudflare/akamai/fastly/etcno longer flagged as technology disclosure. CDN names extracted toCDN_WAF_NAMESconstant, reused in WAF detection.False positives eliminated (usenexus.app.br scan)
Test plan
./gradlew test-- 209 tests passing./gradlew spotlessApply-- formatting cleanServer: nginx/1.21to verify non-CDN disclosure still fires