Add HSTS preload list check via hstspreload.org API (--phone-out)#3060
Open
potato-20 wants to merge 2 commits into
Open
Add HSTS preload list check via hstspreload.org API (--phone-out)#3060potato-20 wants to merge 2 commits into
potato-20 wants to merge 2 commits into
Conversation
Collaborator
|
hi @potato-20 , first: thanks for reviving this! And awesome you amended that with a unit test. Quick shot:
More later. *) there was a discussion here but atm I cannot find it. |
Collaborator
|
PS: if you rebase, the |
Revives and rebases testssl#1809 by @tosticated (Jim Blankendaal) onto 3.3dev. When --phone-out is set, run_hsts now queries https://hstspreload.org/api/v2/status and reports whether the domain is on the browser HSTS preload list (preloaded/pending/rejected/unknown), cross-referenced with the served header, the same-domain check and the bulk flag. Addresses the review comments on testssl#1809: the API-response matching uses native bash string matching instead of forking grep, the JSON quoting is handled inside check_hsts_preloadlist_match() so callers pass plain values, and the value arrays use 'local -a'. The output decision table is kept as-is (per maintainer feedback). Adds t/53_hsts_preload.t. Original design and decision table by @tosticated.
6e70d06 to
391f6a6
Compare
Contributor
Author
|
Fixed — replaced |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Adds an HSTS preload list status check. When
--phone-outis supplied,run_hsts()queries the hstspreload.org status API (/api/v2/status) for the tested host and reports whether the domain ispreloaded/pending/rejected/unknown, combining that with the served-header state (marked-for-preload, same-domain, bulk) to produce an appropriate severity (OK / INFO / LOW / MEDIUM, or WARN if the API is unreachable).Fixes #1248
Supersedes #1809 — this revives @tosticated's (Jim Blankendaal) original work, rebased onto current
3.3dev. Since that PR is a draft on his fork it can't be pushed to, hence a fresh PR; credit is retained inCREDITS.md.What is your pull request about?
If it's a code change please check the boxes which are applicable
help()Notes
[[ ... == *...* ]], nogrepfork), the JSON quoting is handled insidecheck_hsts_preloadlist_match()so callers pass plain values, and the value arrays uselocal -a. The output decision table is kept as-is (per your feedback on HSTS preload list check against API #1809).t/53_hsts_preload.t(github.com listed →preloaded, example.com not →unknown), modeled ont/52_ocsp_revoked.t, coreTest::Moreonly.doc/testssl.1anddoc/testssl.1.htmlare not regenerated here (needs pandoc) — only thedoc/testssl.1.mdsource is updated. Could you regenerate them withmake -C doc?Credit for the original implementation and the decision table goes to @tosticated.