-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fuzz: added fuzz test for listener filter tls_inspector #12617
Changes from all commits
ced5184
0e9dd75
322a04b
65626bb
c77a4e0
c2d205d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
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]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to do another push, tiny nit would be to task to remove this superfluous blank line.