Skip to content

fix(web-incoming): guard req.socket access in error handler#112

Merged
pi0 merged 1 commit intomainfrom
fix/req-socket-undefined-crash
Mar 25, 2026
Merged

fix(web-incoming): guard req.socket access in error handler#112
pi0 merged 1 commit intomainfrom
fix/req-socket-undefined-crash

Conversation

@pi0
Copy link
Copy Markdown
Member

@pi0 pi0 commented Mar 25, 2026

Summary

  • Guard req.socket with optional chaining (req.socket?.destroyed) in the createErrorHandler closure within the stream middleware
  • Prevents TypeError: Cannot read properties of undefined (reading 'destroyed') crash when req.socket is undefined (e.g. HTTP/2 requests or edge-case teardown scenarios)
  • Adds regression test that reproduces the crash

Upstream ref: http-party/node-http-proxy#1634

use optional chaining for `req.socket?.destroyed` to prevent
TypeError crash when `req.socket` is undefined (e.g. HTTP/2).

ref: http-party/node-http-proxy#1634
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

Warning

Rate limit exceeded

@pi0 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 20 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0b19ee97-25f4-4152-afa7-55f73d529a4f

📥 Commits

Reviewing files that changed from the base of the PR and between b44af4a and 839a489.

📒 Files selected for processing (2)
  • src/middleware/web-incoming.ts
  • test/middleware/web-incoming.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/req-socket-undefined-crash

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pi0 pi0 merged commit 1f7e65c into main Mar 25, 2026
5 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.49%. Comparing base (8724245) to head (839a489).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #112      +/-   ##
==========================================
+ Coverage   96.14%   97.49%   +1.34%     
==========================================
  Files           8        8              
  Lines         623      679      +56     
  Branches      233      269      +36     
==========================================
+ Hits          599      662      +63     
+ Misses         24       17       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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