Navigation Menu

Skip to content
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: json_fuzz_test for RapidJSON and Protobuf parsing. #8658

Merged
merged 5 commits into from Oct 18, 2019

Conversation

htuch
Copy link
Member

@htuch htuch commented Oct 18, 2019

We have multiple third party JSON parsers in Envoy, both RapidJSON and Protobuf.
Fuzz both RapidJSON and Protobuf JSON loading from a test corpus derived from
json_loader_test.cc. Ideally we would be doing differential fuzzing and be
able to compare outputs, e.g. success/failure, recursive traversal of the
structured objects for equivalence checking. However, even on basic files
with non-printable ASCII, there are some difference, so we'll need to think a
bit more about the modulo operator we want to use. For now, at least we get
crash fuzzing.

While both libraries already have some fuzzing, this allows us to
trust-but-verify and provides a platform to allow us to do differential
fuzzing in the future.

This fuzzer seems quite healthy, it's clipping along at ~2k exec/s.

Risk level: Low
Testing: bazel run //test/common/json:json_fuzz_test_with_libfuzzer --config asan-fuzzer

Signed-off-by: Harvey Tuch htuch@google.com

We have multiple third party JSON parsers in Envoy, both RapidJSON and Protobuf.
Fuzz both RapidJSON and Protobuf JSON loading from a test corpus derived from
json_loader_test.cc. Ideally we would be doing differential fuzzing and be
able to compare outputs, e.g. success/failure, recursive traversal of the
structured objects for equivalence checking. However, even on basic files
with non-printable ASCII, there are some difference, so we'll need to think a
bit more about the modulo operator we want to use. For now, at least we get
crash fuzzing.

While both libraries already have some fuzzing, this allows us to
trust-but-verify and provides a platform to allow us to do differential
fuzzing in the future.

This fuzzer seems quite healthy, it's clipping along at ~2k exec/s.

Risk level: Low
Testing: bazel run //test/common/json:json_fuzz_test_with_libfuzzer --config asan-fuzzer

Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
mattklein123
mattklein123 previously approved these changes Oct 18, 2019
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

test/common/json/json_fuzz_test.cc Outdated Show resolved Hide resolved
Signed-off-by: Harvey Tuch <htuch@google.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks.

@htuch htuch merged commit 7a3c96e into envoyproxy:master Oct 18, 2019
@htuch htuch deleted the json-fuzzer branch October 18, 2019 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants