Skip to content

Potential Vulnerability in Cloned Code#3086

Closed
pr-hung wants to merge 1 commit intoboostorg:developfrom
pr-hung:clone-security-fix-b647f263b0
Closed

Potential Vulnerability in Cloned Code#3086
pr-hung wants to merge 1 commit intoboostorg:developfrom
pr-hung:clone-security-fix-b647f263b0

Conversation

@pr-hung
Copy link
Copy Markdown

@pr-hung pr-hung commented Mar 11, 2026

Summary

This PR fixes a potential security vulnerability in cloned code that appears to have missed an upstream security patch.

Details

  • Affected file: test/bench/parser/nodejs-parser/http_parser.c
  • Upstream fix commit: nodejs/http-parser@7d5c99d
  • Clone similarity score: 0.998532

What this PR does

  • Applies the upstream security fix logic to the cloned implementation in this repository.

References

Please review and merge this PR to ensure your repository is protected against this potential vulnerability.
Thank you for your time !

@sehe
Copy link
Copy Markdown
Contributor

sehe commented Mar 11, 2026

This code, as the names suggest, is part of a comparative benchmark only. As such, the code was cloned at the specific time the comparison was done, and represents an "archive copy" for reproducing the results. Of course, we might remove the archive copy and replace it with a revision link to the source repository, or at least clearly mark the files as old and having security issues.

But in short, unless users willingly do not use Boost Beast, but instead use some benchmark code that is not part of Boost Beast, there is no security issue here.

Interestingly, Beast might have corresponding issues with multiple Transfer-Encodings, but that's not the topic of this issue.

@ashtum
Copy link
Copy Markdown
Collaborator

ashtum commented Apr 13, 2026

Sorry for the late reply.

Interestingly, Beast might have corresponding issues with multiple Transfer-Encodings, but that's not the topic of this issue.

I think there are two specific issues the Node.js commit addressed:

The presence of both Transfer-Encoding and Content-Length, which is properly handled in Beast here:

// conflicting field
if(f_ & flagChunked)
return bad_content_length();

if(f_ & flagContentLength)
{
// conflicting field
BOOST_BEAST_ASSIGN_EC(ec, error::bad_transfer_encoding);
return;
}

Multiple Transfer-Encoding values with chunked not in last position, which is also handled here:

auto const v = token_list{value};
auto const p = std::find_if(v.begin(), v.end(),
[&](string_view const& s)
{
return beast::iequals("chunked"_sv, s);
});
if(p == v.end())
return;
if(std::next(p) != v.end())
return;

When chunked is not the last encoding, neither flagChunked nor flagContentLength is set, so Beast silently falls back to read-until-EOF mode, which is correct per RFC 7230 §3.3.3.

@ashtum ashtum closed this Apr 14, 2026
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.

3 participants