-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add fuzzing core-data dockerfile and script
Closes: issue #4568 Signed-off-by: Valina Li <[email protected]>
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 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 |
---|---|---|
|
@@ -49,3 +49,5 @@ stage/* | |
snap/.snapcraft/* | ||
squashfs-root/ | ||
|
||
# result files | ||
fuzz_results/* |
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,16 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine as builder | ||
|
||
RUN apk add --no-cache python3 py3-pip bash | ||
|
||
RUN wget https://github.com/microsoft/restler-fuzzer/archive/refs/tags/v9.2.0.tar.gz | ||
RUN tar -xvf v9.2.0.tar.gz && mv restler-fuzzer-9.2.0 restler-fuzzer | ||
|
||
RUN cd restler-fuzzer; mkdir -p restler_bin | ||
WORKDIR /restler-fuzzer | ||
RUN python3 ./build-restler.py --dest_dir ./restler_bin/ | ||
|
||
COPY fuzzing_docker.sh /restler-fuzzer/fuzzing.sh | ||
COPY /openapi/v3/core-data.yaml /restler-fuzzer/ | ||
|
||
ENTRYPOINT ["/restler-fuzzer/fuzzing.sh"] | ||
CMD ["core-data", "/restler-fuzzer", "core-data.yaml"] |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
EDGEX_PROJECT_NAME=${1} | ||
echo $EDGEX_PROJECT_NAME | ||
SWAGGER_FILE_PATH=${2} | ||
echo $SWAGGER_FILE_PATH | ||
SWAGGER_FILE_NAME=${3} | ||
echo $SWAGGER_FILE_NAME | ||
|
||
echo "--compile from swagger file" | ||
./restler_bin/restler/Restler compile --api_spec /$SWAGGER_FILE_PATH/$SWAGGER_FILE_NAME | ||
|
||
echo "--test the grammar" | ||
./restler_bin/restler/Restler test --grammar_file ./Compile/grammar.py --dictionary_file ./Compile/dict.json --settings ./Compile/engine_settings.json --no_ssl | ||
|
||
# assuming edgex service is already running on host | ||
echo "--run fuzz-lean" | ||
./restler_bin/restler/Restler fuzz-lean --grammar_file ./Compile/grammar.py --dictionary_file ./Compile/dict.json --settings ./Compile/engine_settings.json --no_ssl | ||
|
||
echo "--copy result logs into $EDGEX_PROJECT_NAME" | ||
mkdir -p /fuzz_result/$EDGEX_PROJECT_NAME | ||
cp -r ./Test/RestlerResults/ /fuzz_results/$EDGEX_PROJECT_NAME/ |