Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: make HTTP_MAX_HEADER_SIZE configurable #24716

Closed

Conversation

mcollina
Copy link
Member

The maximum size of headers introduced in the security release of
2018/11/27 is not configurable. This change adds a
--http-max-header-size option to ./configure.

See: #24693

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. http_parser Issues and PRs related to the HTTP Parser dependency or the http_parser binding. labels Nov 29, 2018
@mcollina
Copy link
Member Author

@mcollina
Copy link
Member Author

cc @nodejs/lts this will need to be backported on all lines. Sorry about not adding this in the security release.

@mcollina
Copy link
Member Author

cc @ofrobots @zauberpony this should solve your need.

@indutny @rvagg I'm not 100% sure how to pass this down to llhttp. Can you please chime in? I couldn't find where HTTP_MAX_HEADER_SIZE is used in llhttp or if it's another define.

@indutny
Copy link
Member

indutny commented Nov 29, 2018

kMaxHeaderSize in src/node_http_parser.cc does this.

@sam-github
Copy link
Contributor

Needs to also modify doc/api/errors.md, probably can't say what the limit is, but can mention that it may be other than the default in a custom node build. The limit could be surfaced through C++, into js as a constant. Isn't there a place already for configure-time constants? @jasnell ?

@rvagg
Copy link
Member

rvagg commented Nov 30, 2018

#ifdef HTTP_MAX_HEADER_SIZE
static const uint64_t kMaxHeaderSize = HTTP_MAX_HEADER_SIZE;
#else
static const uint64_t kMaxHeaderSize = 8 * 1024;
#endif // HTTP_MAX_HEADER_SIZE

Or do we just ditch kMaxHeaderSize?

When we ditch http_parser we could make this configurable from a runtime API, so maybe retaining it will point us in that direction? We could even do it now for when compiled with llhttp I guess.

@mcollina
Copy link
Member Author

@rvagg can you please clarify if I should pass down that definition to our node.gypi file as well? Or it will be automatically picked up?

When we ditch http_parser we could make this configurable from a runtime API, so maybe retaining it will point us in that direction? We could even do it now for when compiled with llhttp I guess.

I think this a very good reason to switch to the new http parser for 12.

The maximum size of headers introduced in the security release of
2018/11/27 is not configurable. This change adds a
--http-max-header-size option to ./configure.

See: nodejs#24693
@mcollina
Copy link
Member Author

The limit could be surfaced through C++, into js as a constant. Isn't there a place already for configure-time constants?

I think we should do so, as changing the value at configure time would make our tests fails with the new configuration. How about http. HTTP_MAX_HEADER_SIZE?

@mcollina mcollina force-pushed the make-http-max-header-size-configurable branch from c2716d1 to 793286c Compare November 30, 2018 09:45
doc/api/errors.md Outdated Show resolved Hide resolved
deps/http_parser/http_parser.gyp Show resolved Hide resolved
@mcollina mcollina force-pushed the make-http-max-header-size-configurable branch from 793286c to c0293de Compare December 1, 2018 16:30
@mcollina
Copy link
Member Author

mcollina commented Dec 3, 2018

CI: https://ci.nodejs.org/job/node-test-pull-request/19154/

@bnoordhuis @nodejs/build may I get a couple of LGTMs?

@richardlau
Copy link
Member

Changes look okay to me, but if we're going to land a runtime configuration option (#24811) I would rather not add more build time configuration options.

@mcollina
Copy link
Member Author

mcollina commented Dec 3, 2018

@richardlau I think both are valid. One sets the default, and the other one changes it at runtime.

@cjihrig what do you think?

@cjihrig
Copy link
Contributor

cjihrig commented Dec 3, 2018

IMO, having a runtime option is desirable because it lets people who are impacted by our recent change continue to run an official build (and not have to build Node themselves). I'm not opposed to also having a build time setting though.

@mcollina
Copy link
Member Author

mcollina commented Dec 3, 2018

IMO, having a runtime option is desirable because it lets people who are impacted by our recent change continue to run an official build (and not have to build Node themselves).

I agree.

@lpinca
Copy link
Member

lpinca commented Mar 11, 2019

Was this superseded by #24811?

@mcollina
Copy link
Member Author

Not really, but there is no urgency to get it landed, and I have other prioritites atm. So, we can close.

@mcollina mcollina closed this Mar 11, 2019
@indutny
Copy link
Member

indutny commented Mar 22, 2019

Should this be ported to v8.x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. http_parser Issues and PRs related to the HTTP Parser dependency or the http_parser binding.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet