fix(scan): grade hsts on the final response scheme after redirects - #310
Conversation
hsts grading was gated on the scheme of the originally requested url, but the client follows redirects, so an http target that redirects to https skipped the hsts check entirely and dropped a high-severity finding. decide the scheme from the final response request url instead, falling back to the requested url only when no response request is set.
pr summary2 files changed (+67 -1)
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #310 +/- ##
=======================================
Coverage ? 54.78%
=======================================
Files ? 81
Lines ? 6878
Branches ? 0
=======================================
Hits ? 3768
Misses ? 2841
Partials ? 269 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vmfunc
left a comment
There was a problem hiding this comment.
right, resp.Request.URL is the final hop and the client follows redirects by default, so an http target that 301s to https was silently dropping the hsts finding before this. grading against the final scheme lines up with reading resp.Header off that same final response too, so it's consistent. fallback and the four test cases are good. in.
hsts grading was gated on the scheme of the originally requested url,
but the client follows redirects, so an http target that redirects to
https skipped the hsts check entirely and dropped a high-severity
finding. decide the scheme from the final response request url instead,
falling back to the requested url only when no response request is set.