Skip to content

fix(ext/node): validate serialized headers in node:http2#36041

Merged
bartlomieju merged 2 commits into
denoland:mainfrom
nathanwhit:fix/http2-header-serialization
Jul 15, 2026
Merged

fix(ext/node): validate serialized headers in node:http2#36041
bartlomieju merged 2 commits into
denoland:mainfrom
nathanwhit:fix/http2-header-serialization

Conversation

@nathanwhit

@nathanwhit nathanwhit commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

  • protect the compact NUL-delimited JavaScript-to-Rust header representation without changing Node's invalid-header behavior
  • replace header-value code units that would become NUL after Latin-1 conversion with an invalid HTTP/2 byte for nghttp2 to reject or drop
  • preserve only supported nghttp2 header flags in the native parser
  • cover scalar, array, pseudo-header, non-ASCII low-byte, and native flag handling

Testing

  • cargo build --bin deno
  • cargo test -p deno_node http2_header_parse --lib -- --nocapture
  • target/debug/deno test -A --config tests/config/deno.json tests/unit_node/http2_test.ts
  • cargo test -p node_compat_tests --test node_compat test-http2-client-unescaped-path -- --nocapture
  • cargo test -p node_compat_tests --test node_compat test-http2-response-splitting -- --nocapture
  • cargo test -p node_compat_tests --test node_compat test-http2-util-headers-list -- --nocapture
  • ./tools/format.js
  • ./tools/lint.js

@nathanwhit
nathanwhit marked this pull request as ready for review July 14, 2026 23:44
@bartlomieju bartlomieju changed the title fix(node_http2): validate serialized headers fix(ext/node): validate serialized headers in node:http2 Jul 15, 2026
@bartlomieju
bartlomieju merged commit d9cb677 into denoland:main Jul 15, 2026
138 checks passed
bartlomieju pushed a commit that referenced this pull request Jul 15, 2026
- protect the compact NUL-delimited JavaScript-to-Rust header
representation without changing Node's invalid-header behavior
- replace header-value code units that would become NUL after Latin-1
conversion with an invalid HTTP/2 byte for nghttp2 to reject or drop
- preserve only supported nghttp2 header flags in the native parser
- cover scalar, array, pseudo-header, non-ASCII low-byte, and native
flag handling
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