-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
Created tls_inspector_corpus and populated with testcases (valid and invalid client hellos) Risk Level: Low Testing: increased function coverage of tls_inspector.cc to 100.0% and line coverage to 87.3% after running fuzzer (covers all parse states except errors related to socket read failure). Docs Changes: N/A Release Notes: N/A Signed-off-by: Arthur Yan <arthuryan@google.com>
- Loading branch information
There are no files selected for viewing
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.
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.
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.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "extensions/filters/listener/tls_inspector/tls_inspector.h" | ||
|
||
#include "test/extensions/filters/listener/common/fuzz/listener_filter_fuzzer.h" | ||
#include "test/extensions/filters/listener/tls_inspector/tls_inspector_fuzz_test.pb.validate.h" | ||
#include "test/fuzz/fuzz_runner.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace ListenerFilters { | ||
namespace TlsInspector { | ||
|
||
DEFINE_PROTO_FUZZER( | ||
const test::extensions::filters::listener::tls_inspector::TlsInspectorTestCase& input) { | ||
|
||
try { | ||
TestUtility::validate(input); | ||
} catch (const ProtoValidationException& e) { | ||
ENVOY_LOG_MISC(debug, "ProtoValidationException: {}", e.what()); | ||
return; | ||
} | ||
|
||
Stats::IsolatedStoreImpl store; | ||
ConfigSharedPtr cfg; | ||
|
||
if (input.max_size() == 0) { | ||
// If max_size not set, use default constructor | ||
cfg = std::make_shared<Config>(store); | ||
} else { | ||
cfg = std::make_shared<Config>(store, input.max_size()); | ||
} | ||
|
||
auto filter = std::make_unique<Filter>(cfg); | ||
|
||
ListenerFilterFuzzer fuzzer; | ||
fuzzer.fuzz(*filter, input.fuzzed()); | ||
} | ||
|
||
} // namespace TlsInspector | ||
} // namespace ListenerFilters | ||
} // namespace Extensions | ||
} // namespace Envoy |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
syntax = "proto3"; | ||
|
||
package test.extensions.filters.listener.tls_inspector; | ||
|
||
import "test/extensions/filters/listener/common/fuzz/listener_filter_fuzzer.proto"; | ||
import "validate/validate.proto"; | ||
|
||
message TlsInspectorTestCase { | ||
uint32 max_size = 1 [(validate.rules).uint32.lte = 65536]; | ||
test.extensions.filters.listener.FilterFuzzTestCase fuzzed = 2 | ||
[(validate.rules).message.required = true]; | ||
} |