Skip to content

Validate gRPC HPACK request fields#37

Open
xintenseapple wants to merge 1 commit into
freenginx:defaultfrom
xintenseapple:fix/issue-28-grpc-hpack-max-field
Open

Validate gRPC HPACK request fields#37
xintenseapple wants to merge 1 commit into
freenginx:defaultfrom
xintenseapple:fix/issue-28-grpc-hpack-max-field

Conversation

@xintenseapple

Copy link
Copy Markdown

Summary:

  • Validate gRPC request HPACK field lengths before using fixed HPACK integer reservations for method, path, authority, configured headers, and pass-through headers.

Verification:

  • git diff --check; ./auto/configure --with-http_v2_module --without-http_rewrite_module --without-http_gzip_module; make -f objs/Makefile -j2; objs/nginx -t -p "$PWD/" -c conf/nginx.conf

Fixes #28

@mdounin

mdounin commented Jun 13, 2026

Copy link
Copy Markdown
Member

As demonstrated in #27, script length calculations might change over time even if all the variables are flushed. Since the checks added are not expected to be hit in practice and more like "last resort" checks to ensure there will be no overflow, it would be better to put the script-related checks where the actual serialization happens, to ensure all the possible issues are catched.

Placing relevant checks to where the actual serialization happens should also improve generated error messages (in the patch, most errors do not contain affected header names/values, as these are not available yet). Similarly, it would make it possible to get rid of seemingly unrelated changes in uri_len calculation, which are needed by the patch to correctly calculate length of the resulting URI. I've submitted a patch series which implements this approach.

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.

gRPC request serialization overflows on oversized HPACK :path

3 participants