Skip to content

uhv: add http-parser permissive parsing mode for h1 codec#20528

Closed
ameily wants to merge 24 commits intoenvoyproxy:mainfrom
trail-of-forks:uhv-h1-permissive-parsing
Closed

uhv: add http-parser permissive parsing mode for h1 codec#20528
ameily wants to merge 24 commits intoenvoyproxy:mainfrom
trail-of-forks:uhv-h1-permissive-parsing

Conversation

@ameily
Copy link
Copy Markdown
Contributor

@ameily ameily commented Mar 25, 2022

Commit Message: uhv: add http-parser permissive parsing mode for h1 codec

Additional Description: Adds a new setting to http-parser, permissive_parsing which enables permissive parsing mode (disabled by default). Strict vs permissive parsing was previously controlled by a compile time definition, HTTP_PARSER_STRICT, and my work was primarily making this a runtime flag on a per-message basis. I brought in the http-parser unit tests to make sure that nothing broke in the conversion. Then, based on the PR for H2, #20381, this underlying setting is controlled with the CodecHeaderValidationMode enumeration in the H1 codec and legacy parser. For now, all code that creates an H1 codec or parser are hardcoded to set the validation mode to Enabled to preserve the current behavior.

Risk Level: Low

Testing:

Docs Changes:

Release Notes:

Platform Specific Features:

Fixes #19750

ameily added 5 commits March 25, 2022 09:16
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
@ameily
Copy link
Copy Markdown
Contributor Author

ameily commented Mar 25, 2022

@yanavlasov Can you take a look at this when you get a chance (assuming CI passes)?

@phlax
Copy link
Copy Markdown
Member

phlax commented Mar 25, 2022

copying out CI advice

  Please fix your editor to ensure:

      - no trailing whitespace
      - no preceding mixed tabs/spaces
      - all files end with a newline

ameily added 2 commits March 25, 2022 10:22
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
@adisuissa
Copy link
Copy Markdown
Contributor

@yanavlasov can you PTAL?

ameily added 13 commits March 31, 2022 08:27
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Apr 4, 2022
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @moderation

🐱

Caused by: #20528 was synchronize by ameily.

see: more, trace.

…isive parsing

Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Copy link
Copy Markdown
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks this looks great. Just one small nit

/wait

ameily added 2 commits April 6, 2022 17:11
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
Signed-off-by: Adam Meily <adam.meily@trailofbits.com>
@ameily
Copy link
Copy Markdown
Contributor Author

ameily commented Apr 7, 2022

The tests that are failing in CI are working fine locally and were previously running successfully before my last commit, which shouldn't have affected them.

@alyssawilk
Copy link
Copy Markdown
Contributor

I think we can get away with build options and testing on the compile time build - I'll let Yan touch base with you on details but please ping back after you sync with him if you have follow up questions?

@ameily
Copy link
Copy Markdown
Contributor Author

ameily commented Apr 18, 2022

I'm closing this in favor of a new solution that builds upon the uhv_enabled build flag.

@ameily ameily closed this Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deps Approval required for changes to Envoy's external dependencies waiting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uhv: http-parser: add option to skip header validation

6 participants