Skip to content

quic: truncate CONNECTION_CLOSE frame reason field - #66644

Open
efekrskl wants to merge 3 commits into
nodejs:mainfrom
efekrskl:quic/truncate-close-reason
Open

efekrskl wants to merge 3 commits into
nodejs:mainfrom
efekrskl:quic/truncate-close-reason

Conversation

@efekrskl

Copy link
Copy Markdown
Member

Long reason strings inside a CONNECTION_CLOSE frame could exceed the space available and crash the process.

This PR limits the reason string to 256 UTF-8 bytes. Any string longer than the limit will get truncated. Also adds new tests and updates the documentation.

I think 256 bytes is a sensible default because the default maximum UDP datagram payload size is 1200 bytes. Before the handshake ngtcp2 can coalesce packets, encoding the same reason with 768 (3x256) bytes at most, this should leave enough headroom. This also matches Google QUICHE's limit

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/quic

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Oct 10, 2026
Signed-off-by: Efe Karasakal <hi@efe.dev>
Signed-off-by: Efe Karasakal <hi@efe.dev>
@efekrskl
efekrskl force-pushed the quic/truncate-close-reason branch from 8f2fdd1 to 63c637c Compare October 10, 2026 12:38
@codecov

codecov Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.44%. Comparing base (c0daf39) to head (b1f7e9e).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66644      +/-   ##
==========================================
+ Coverage   90.43%   90.44%   +0.01%     
==========================================
  Files         791      791              
  Lines      276593   276816     +223     
  Branches    53112    53195      +83     
==========================================
+ Hits       250126   250375     +249     
+ Misses      16867    16837      -30     
- Partials     9600     9604       +4     

see 41 files with indirect coverage changes

🚀 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.

@inoway46

Copy link
Copy Markdown
Contributor

https://github.com/nodejs/node/actions/runs/38052685564/job/114214912806
This build failure has been fixed in #66603.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants