OTWO-7711 CWE-319: HSTS header missing — config.force_ssl disabled in… - #1943
Open
Niharika1117 wants to merge 2 commits into
Open
OTWO-7711 CWE-319: HSTS header missing — config.force_ssl disabled in…#1943Niharika1117 wants to merge 2 commits into
Niharika1117 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Enables HTTPS enforcement and HSTS in the Rails app’s staging and production environments to address missing HSTS header / disabled config.force_ssl.
Changes:
- Turn on
config.force_sslinstagingandproduction. - Add
config.ssl_optionsto emit HSTS (initialmax-age=300) and configure redirect exclusions for health/readiness probing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| config/environments/staging.rb | Enables force_ssl and sets HSTS/redirect behavior for staging. |
| config/environments/production.rb | Enables force_ssl and sets HSTS/redirect behavior for production. |
Suppressed comments (2)
config/environments/production.rb:54
- The SSL redirect exclusion is configured for
/ready, but this app's health endpoint route is/health(config/routes.rb:35–36). Withconfig.force_ssl = true,/healthwill still redirect to HTTPS and can cause readinessProbe redirect loops.
config.ssl_options = {
hsts: { expires: 300, subdomains: true },
redirect: { exclude: ->(request) { request.path == '/ready' } }
}
config/environments/staging.rb:54
- The SSL redirect exclusion is configured for
/ready, but this app's health endpoint route is/health(config/routes.rb:35–36). Withconfig.force_ssl = true,/healthwill still redirect to HTTPS and can cause readinessProbe redirect loops.
config.ssl_options = {
hsts: { expires: 300, subdomains: true },
redirect: { exclude: ->(request) { request.path == '/ready' } }
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
… staging/prod