diff --git a/.gitignore b/.gitignore index 1405414..53a0aac 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,6 @@ build/ !gradle/wrapper/gradle-wrapper.jar !**/src/main/**/build/ !**/src/test/**/build/ + +# Fuzzing: Cats +cats-report/ diff --git a/infra/fuzzing/cats/download.sh b/infra/fuzzing/cats/download.sh new file mode 100755 index 0000000..d401a22 --- /dev/null +++ b/infra/fuzzing/cats/download.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +cd "$(dirname "$0")" || exit + +VERSION=11.4.0 +DIST=cats_uberjar_$VERSION.tar.gz + +wget https://github.com/Endava/cats/releases/download/cats-$VERSION/$DIST + +tar -xzvf $DIST +rm $DIST +rm ._cats.jar diff --git a/infra/fuzzing/cats/run.sh b/infra/fuzzing/cats/run.sh new file mode 100755 index 0000000..1a8d3ef --- /dev/null +++ b/infra/fuzzing/cats/run.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env sh + +cd "$(dirname "$0")" || exit + +API_SPEC=../../../botalka/src/main/resources/static/openapi/api.yml +SERVER=http://localhost:8080 + +MODE=$1 +METHOD=$2 +METHOD_PATH=$3 + + +if [ "$MODE" = "basic" ]; then + java -jar cats.jar \ + --contract=$API_SPEC \ + --server=$SERVER \ + --blackbox \ + --printExecutionStatistics \ + --reportFormat=HTML_ONLY +elif [ "$MODE" = "random" ]; then + java -jar cats.jar random \ + --contract=$API_SPEC \ + --server=$SERVER/api/v1 \ + --printExecutionStatistics \ + --reportFormat=HTML_ONLY \ + --path="$METHOD_PATH" \ + --mc=500 \ + -X "$METHOD" \ + --stopAfterTimeInSec 240 +else + echo "Usage:" + echo " - run.sh basic" + echo " - run.sh random " +fi