Skip to content

fix: detect secure socket when connection is missing#1124

Merged
bjohansebas merged 2 commits into
expressjs:masterfrom
raashish1601:fix/socket-secure-detection
Jul 6, 2026
Merged

fix: detect secure socket when connection is missing#1124
bjohansebas merged 2 commits into
expressjs:masterfrom
raashish1601:fix/socket-secure-detection

Conversation

@raashish1601

Copy link
Copy Markdown
Contributor

Changes

  • Update secure-request detection to fall back to req.socket.encrypted when req.connection is missing.
  • Preserve existing req.connection precedence while supporting environments where only req.socket is available.
  • Add regression test under session() cookie security behavior: treat request as secure when connection is missing but socket.encrypted is true.

Validation

  • npm run lint
  • npx mocha --require test/support/env --check-leaks --no-exit --reporter spec test/

@bjohansebas
bjohansebas force-pushed the fix/socket-secure-detection branch from 3167506 to 1321162 Compare July 6, 2026 02:09

@bjohansebas bjohansebas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@bjohansebas
bjohansebas merged commit 953bfe2 into expressjs:master Jul 6, 2026
33 checks passed
@bjohansebas bjohansebas mentioned this pull request Jul 6, 2026
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