Skip to content

Commit

Permalink
[fuzz] fix filter crashes from OSS fuzz (#12152)
Browse files Browse the repository at this point in the history
* fix filter fuzzer crash from OSS fuzz by checking for non-implemented proto fields
This will raise an exception that will be caught and abort the test run when an unimplemented oneof field is hit by the fuzzer

Signed-off-by: Sam Flattery <[email protected]>
  • Loading branch information
samflattery authored Jul 20, 2020
1 parent b250fed commit e6c57fa
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/envoy/config/tap/v3/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ message OutputSink {

// [#not-implemented-hide:]
// GrpcService to stream data to. The format argument must be PROTO_BINARY.
// [#comment: TODO(samflattery): remove cleanup in uber_per_filter.cc once implemented]
StreamingGrpcSink streaming_grpc = 4;
}
}
Expand Down
1 change: 1 addition & 0 deletions api/envoy/config/tap/v4alpha/common.proto

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

1 change: 1 addition & 0 deletions generated_api_shadow/envoy/config/tap/v3/common.proto

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

1 change: 1 addition & 0 deletions generated_api_shadow/envoy/config/tap/v4alpha/common.proto

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

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

13 changes: 13 additions & 0 deletions test/extensions/filters/http/common/fuzz/uber_per_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ void cleanTapConfig(Protobuf::Message* message) {
config.mutable_common_config()->mutable_static_config()->mutable_match_config()->set_any_match(
true);
}
// TODO(samflattery): remove once StreamingGrpcSink is implemented
else if (config.common_config().config_type_case() ==
envoy::extensions::common::tap::v3::CommonExtensionConfig::ConfigTypeCase::
kStaticConfig &&
config.common_config()
.static_config()
.output_config()
.sinks(0)
.output_sink_type_case() ==
envoy::config::tap::v3::OutputSink::OutputSinkTypeCase::kStreamingGrpc) {
// will be caught in UberFilterFuzzer::fuzz
throw EnvoyException("received input with not implemented output_sink_type StreamingGrpcSink");
}
}

void UberFilterFuzzer::cleanFuzzedConfig(absl::string_view filter_name,
Expand Down
1 change: 1 addition & 0 deletions tools/spelling/spelling_dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@ tuples
typedef
typeid
typesafe
uber
ucontext
udpa
uint
Expand Down

0 comments on commit e6c57fa

Please sign in to comment.