Harden HTTP header parsing and body framing validation #36243

pull ahsan-syed-32 wants to merge 2 commits into bitcoin:master from ahsan-syed-32:master changing 2 files +32 −0
  1. ahsan-syed-32 commented at 5:12 AM on September 14, 2026: none

    Motivation

    • Ensure HTTP header field-names conform to RFC to protect against malformed or potentially hostile headers.
    • Avoid potential ambiguous framing by refusing requests containing both Transfer-Encoding and Content-Length.

    Implementation Details

    • Header field-names token character whitelist and validation using find_first_not_of with an error of "Invalid HTTP header field-name" thrown upon failure.
    • Check in HTTPRequest::LoadBody throwing "Message contains both Transfer-Encoding and Content-Length headers" when both headers are found.

    Tests

    • Tests for invalid header token characters added to src/test/httpserver_tests.cpp.
    • Tests for rejecting requests containing Transfer-Encoding: chunked and Content-Length added to src/test/httpserver_tests.cpp.

    Testing

    • HTTP server tests from src/test/httpserver_tests.cpp including the new ones for header tokens validation and ambiguous framing were run successfully.
    • The old header parser and request body tests were run successfully along with the new tests.
  2. http: validate request header field names cab06cb482
  3. Merge pull request #1 from ahsan-syed-32/codex/locate-and-fix-critical-bug
    Harden HTTP header parsing and body framing validation
    eb6ef84f9b
  4. DrahtBot commented at 5:12 AM on September 14, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36243.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. fanquake closed this on Sep 14, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-09-22 05:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me