[api] [fuzz] fix many header related config fuzz bugs (#10093)
This change includes validations on header names and values that appear in config fields. This prevents setting header keys/values with invalid characters in config fields, which pops up as ASSERT failures when converting to HeaderString values. For reference, the well_known_regex for the header names and values do the following: - HTTP_HEADER_NAME: whitelists alphanums and the whitelisted tokens (`!#$%&'*+-.^_|~``) in https://tools.ietf.org/html/rfc7230#section-3.2 - HTTP_HEADER_VALUE: blacklists control characters except SPC and TAB. Purposely meant to be permissive, and blacklist problems like nulls Changes in `base.proto` * Invalid headers to match (from [`HeaderValue`](master-ci-test88d3556981/api/envoy/api/v2/core/base.proto (L234)
) proto) - `clusterfuzz-testcase-minimized-route_fuzz_test-5635252339343360` Changes in `route_components.proto`: * [domains](88d3556981/api/envoy/api/v2/route/route_components.proto (L75)
) with invalid control characters in `VirtualHost` config - `clusterfuzz-testcase-minimized-route_fuzz_test-5699465522970624` * Invalid [header_name](88d3556981/api/envoy/api/v2/route/route_components.proto (L604)
) in hash policy - `clusterfuzz-testcase-minimized-route_fuzz_test-5634743613259776` * Invalid control characters in [upgrade_type](88d3556981/api/envoy/api/v2/route/route_components.proto (L698)
) header - `clusterfuzz-testcase-minimized-route_fuzz_test-5750746072481792` * `RateLimit` message has a [header_name](88d3556981/api/envoy/api/v2/route/route_components.proto (L1273)
) field - `clusterfuzz-testcase-minimized-route_fuzz_test-5206842068697088` * Invalid [response_headers_to_add](88d3556981/api/envoy/api/v2/route/route_components.proto (L113)
) in - `clusterfuzz-testcase-minimized-route_fuzz_test-4592245302362112` * The [cluster_header](88d3556981/api/envoy/api/v2/route/route_components.proto (L723)
) change came up in a fuzz bug, but after that was fixed, the code ran in to another deeper issue to be fixed. * The [name](bbdc33e537/api/envoy/config/route/v3/route_components.proto (L1381)
) in `HeaderMatcher` message - `clusterfuzz-testcase-minimized-route_fuzz_test-5635252339343360` Changes in `custom_tag.proto` * `CustomTag` has a [name](88d3556981/api/envoy/type/tracing/v3/custom_tag.proto (L51)
) - `clusterfuzz-testcase-minimized-route_fuzz_test-5661762636742656` Changes in fuzz tests: * `conn_manager_impl_fuzz_test` that fails on invalid characters in an authority header. this is not a config related change, just handled by replaced the invalid character in the fuzz test. - `clusterfuzz-testcase-minimized-conn_manager_impl_fuzz_test-5714279517126656` * `route_fuzz_test` was cleaned up now that a lot of the processing was moved to config. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19923 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16143 (most of) Signed-off-by: Asra Ali <asraa@google.com> Mirrored from https://github.com/envoyproxy/envoy @ 855b2a359a7133fd559ddbd757be4c0963cd8a73
parent
35d8df254d
commit
bb2dc33477
9 changed files with 54 additions and 26 deletions
Loading…
Reference in new issue