-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sdk): Fuzz testing and protocol fixes (#214)
This change includes a variety of fixes found with fuzz testing. * Protocol Exception improvements - `NullPointerExceptions` have been converted to other exception types. Please provde feedback on if other exception types should be used for these cases. In `Fuzzing.java` now also serves to define in testing what exception types are acceptable. The `catch` specifically lists the types of exceptions that were discovered for each API call, and `throws` are checked exceptions that are not expected to be possible. As a future improvement we may want to refine this list further and better document what exceptions happen under what conditions. For now I thought it was best to start with just the `NullPointerException` cases. Since these cases were numerous, these changes span multiple commits, with each commit focused on a specific area of the protocol. * Protocol DoS Fixes - The only memory consumption issue discovered was the [counterpart found in the go sdk](opentdf/platform#1536). A matching fix with the same defaults was implemented here in the java sdk. * Finally the testing itself is added as `Fuzzing.java` executed through `sdk/fuzz.sh`. This script is long running, and there are occasional Jazzer failures which are not believed to be real deficiencies (timeouts when `.position()` is called on the stream). For that reason this testing needs to be done manually, and not expected to be included in CI * A few optimizations and clarity improvements were also included, as they were noticed while generally trying to get familiar with the codebase.
- Loading branch information
Showing
25 changed files
with
341 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
tests=("fuzzNanoTDF", "fuzzTDF", "fuzzZipRead") | ||
base_seed_dir="src/test/resources/io/opentdf/platform/sdk/FuzzingInputs/" | ||
|
||
for test in "${tests[@]}"; do | ||
seed_dir="${base_seed_dir}${test}" | ||
echo "Running $test fuzzing with seeds from $seed_dir" | ||
mvn verify -P fuzz -Djazzer.testDir=$seed_dir | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.