Skip to content

Add HSTS policy validation for includeSubDomains and preload - #72

Open
goosvorbook wants to merge 2 commits into
santoru:masterfrom
goosvorbook:master
Open

goosvorbook wants to merge 2 commits into
santoru:masterfrom
goosvorbook:master

Conversation

@goosvorbook

Copy link
Copy Markdown

Add HSTS policy validation

Summary

This PR extends the Strict-Transport-Security check to validate the HSTS policy, not just the presence of the header.

Changes

  • Validate max-age
  • Detect max-age=0
  • Warn when includeSubDomains is missing
  • Report missing preload as informational
  • Add HSTS details to JSON output
  • Add tests

Example

For:

Strict-Transport-Security: max-age=31536000

shcheck now reports:

[!] HSTS includeSubDomains directive is missing; subdomains are not covered
[i] HSTS preload directive is not set (optional)

The analyze_hsts function was added to parse HSTS header values, validate directives, and return findings. It checks for issues related to max-age, includeSubDomains, and preload directives.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant