Skip to content

Commit

Permalink
[fuzz] Added checks for http3 in server fuzz tests (#13160)
Browse files Browse the repository at this point in the history
Additional Description: HTTP3 is not yet supported in production, so added checks so fuzzer wouldn't fuzz configs with HTTP3.

Signed-off-by: Zach <zasweq@google.com>
  • Loading branch information
zasweq authored Sep 23, 2020
1 parent ac96ed9 commit 4732752
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 2 deletions.
13 changes: 12 additions & 1 deletion test/server/config_validation/config_fuzz_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@ namespace {
// Derived from //test/server:server_fuzz_test.cc, but starts the server in configuration validation
// mode (quits upon validation of the given config)
DEFINE_PROTO_FUZZER(const envoy::config::bootstrap::v3::Bootstrap& input) {
envoy::config::bootstrap::v3::Bootstrap sanitizedInput(input);
// TODO(asraa): QUIC is not enabled in production code yet, so remove references for HTTP3.
// Tracked at https://github.com/envoyproxy/envoy/issues/9513.
for (auto& cluster : *sanitizedInput.mutable_static_resources()->mutable_clusters()) {
for (auto& health_check : *cluster.mutable_health_checks()) {
if (health_check.http_health_check().codec_client_type() ==
envoy::type::v3::CodecClientType::HTTP3) {
health_check.mutable_http_health_check()->clear_codec_client_type();
}
}
}
testing::NiceMock<MockOptions> options;
TestComponentFactory component_factory;
Fuzz::PerTestEnvironment test_env;

const std::string bootstrap_path = test_env.temporaryPath("bootstrap.pb_text");
std::ofstream bootstrap_file(bootstrap_path);
bootstrap_file << input.DebugString();
bootstrap_file << sanitizedInput.DebugString();
options.config_path_ = bootstrap_path;
options.log_level_ = Fuzz::Runner::logLevel();

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion test/server/server_fuzz_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ makeHermeticPathsAndPorts(Fuzz::PerTestEnvironment& test_env,
for (auto& health_check : *cluster.mutable_health_checks()) {
// TODO(asraa): QUIC is not enabled in production code yet, so remove references for HTTP3.
// Tracked at https://github.com/envoyproxy/envoy/issues/9513.
health_check.mutable_http_health_check()->clear_codec_client_type();
if (health_check.http_health_check().codec_client_type() ==
envoy::type::v3::CodecClientType::HTTP3) {
health_check.mutable_http_health_check()->clear_codec_client_type();
}
}
// We may have both deprecated hosts() or load_assignment().
for (auto& host : *cluster.mutable_hidden_envoy_deprecated_hosts()) {
Expand Down

0 comments on commit 4732752

Please sign in to comment.