-
Notifications
You must be signed in to change notification settings - Fork 5.5k
http3: validating codec #17452
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
http3: validating codec #17452
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -930,6 +930,16 @@ Network::DrainableFilterChainSharedPtr ListenerFilterChainFactoryBuilder::buildF | |
| "{}. \nUse QuicDownstreamTransport instead.", | ||
| transport_socket.DebugString())); | ||
| } | ||
| const std::string config_str = | ||
| filter_chain.filters_size() == 0 ? "" : filter_chain.filters(0).DebugString(); | ||
| const std::string hcm_str = | ||
| "envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"; | ||
| if (is_quic && (filter_chain.filters().size() != 1 || !absl::StrContains(config_str, hcm_str) || | ||
| !absl::StrContains(config_str, "codec_type: HTTP3"))) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. StrContains() is inefficient and this doesn't prevent other codec types from being misconfigured to HTTP3. As to codec_type, the caller of HttpConnectionManagerConfig::createCodec() -- Http::ConnectionManagerImpl-- actually knows if the connection is quic or not. Can we modify createCodec() interface to take in a bool and always create a Http3 codec if it's true? If the pass-in value isn't consistent with configured codec type, i.e. createCodec(/is_quic/true) with codec_type_ != HTTP3 or createCodec(/is_quic/false) with codec_type_ == HTTP3, create whatever makes the most sense and warn about that.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. switching to hcm type url makes sense.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't love doing the unpack twice, but why not unpack the HCM config into a real object, and then do the check in code? That would be a lot less hacky than doing str contains on a debug string? Another option if we don't want to unpack twice. What about doing this check in the HCM config load itself? We could probably figure out a way to get back to the listener config and do the check there? /wait-any |
||
| throw EnvoyException(fmt::format( | ||
| "error building network filter chain for quic listener: requires exactly one http_" | ||
| "connection_manager filter with an HTTP/3 codec.")); | ||
| } | ||
| #else | ||
| // When QUIC is compiled out it should not be possible to configure either the QUIC transport | ||
| // socket or the QUIC listener and get to this point. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't used anymore?