Skip to content

OTWO-7711 CWE-319: HSTS header missing — config.force_ssl disabled in… - #1943

Open
Niharika1117 wants to merge 2 commits into
stagingfrom
OTWO-7711
Open

OTWO-7711 CWE-319: HSTS header missing — config.force_ssl disabled in…#1943
Niharika1117 wants to merge 2 commits into
stagingfrom
OTWO-7711

Conversation

@Niharika1117

Copy link
Copy Markdown
Contributor

… staging/prod

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_ssl in staging and production.
  • Add config.ssl_options to emit HSTS (initial max-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). With config.force_ssl = true, /health will 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). With config.force_ssl = true, /health will 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.

Comment thread config/environments/production.rb Outdated
Comment thread config/environments/staging.rb Outdated
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.

2 participants