[balsa] Add config field to enable custom methods. (#26448)

* [balsa] Add config field to enable custom methods.

This is no behavioral change by default: only methods from a hard-coded
list (that matches the list hard-coded in http-parser, and is slightly
different from the one that will be used by UHV) are accepted.

Then the new knob is true, BalsaParser does the exact same validation as
UHV will by default: method has to be non-empty and only contain allowed
characters.

When UHV method validation logic is turned on in the future, all
validation can be removed from BalsaParser. When non-UHV mode is
deprecated, this new proto field can be removed.

Tracking issue: #21245

Signed-off-by: Bence Béky <bnc@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ 8c17c7a8c91380b2ad5d2e352db94fd1c7571d46
pull/626/head
data-plane-api(Azure Pipelines) 2 years ago
parent d852b5d48d
commit 91bf190c58
  1. 15
      envoy/config/core/v3/protocol.proto

@ -259,7 +259,7 @@ message HttpProtocolOptions {
google.protobuf.UInt32Value max_requests_per_connection = 6;
}
// [#next-free-field: 10]
// [#next-free-field: 11]
message Http1ProtocolOptions {
option (udpa.annotations.versioning).previous_message_type =
"envoy.api.v2.core.Http1ProtocolOptions";
@ -358,6 +358,19 @@ message Http1ProtocolOptions {
// See issue #21245.
google.protobuf.BoolValue use_balsa_parser = 9
[(xds.annotations.v3.field_status).work_in_progress = true];
// [#not-implemented-hide:] Hiding so that field can be removed.
// If true, and BalsaParser is used (either `use_balsa_parser` above is true,
// or `envoy.reloadable_features.http1_use_balsa_parser` is true and
// `use_balsa_parser` is unset), then every non-empty method with only valid
// characters is accepted. Otherwise, methods not on the hard-coded list are
// rejected.
// Once UHV is enabled, this field should be removed, and BalsaParser should
// allow any method. UHV validates the method, rejecting empty string or
// invalid characters, and provides :ref:`restrict_http_methods
// <envoy_v3_api_field_extensions.http.header_validators.envoy_default.v3.HeaderValidatorConfig.restrict_http_methods>`
// to reject custom methods.
bool allow_custom_methods = 10 [(xds.annotations.v3.field_status).work_in_progress = true];
}
message KeepaliveSettings {

Loading…
Cancel
Save