Skip to content

refactor:add hsts header - #7

Open
deepsource-dev-autofix[bot] wants to merge 1 commit into
v1.18.1-basefrom
deepsource-autofix-9c5dcfee
Open

refactor:add hsts header#7
deepsource-dev-autofix[bot] wants to merge 1 commit into
v1.18.1-basefrom
deepsource-autofix-9c5dcfee

Conversation

@deepsource-dev-autofix

Copy link
Copy Markdown

This PR enhances transport-layer security by enforcing HTTPS connections through the HTTP Strict-Transport-Security (HSTS) header. A conditional check was added so that the header is only sent when the connection is already secure.

Changes:

  • Missing HSTS Header: The application previously did not include an HSTS header on HTTPS responses, leaving it vulnerable to protocol downgrade and cookie hijacking attacks. This patch adds a check for $_SERVER['HTTPS'] and sets Strict-Transport-Security: max-age=31536000; includeSubDomains; preload to instruct browsers to only use HTTPS for the next year. We included includeSubDomains and preload to cover all subdomains and request inclusion in browser preload lists, respectively; please verify that all subdomains support HTTPS before merging and adjust these directives as needed.

This Autofix was generated by AI. Please review the change before merging.

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.

0 participants