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

[WIP] Add Jazzer configuration to run in an Action #664

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/jazzer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

Move to scripts folder, please.


# Usage:
# ./entrypoint.sh \
# --version 1.3.0 --package io.dapr.client --class DaprClientBuilder \
# --methods "withObjectSerializer withStateSerializer builder" \
# --keep-going=1

set -u

# Set default values
Version="1.3.1"
Package=""
Class=""
Methods=""
KeepGoingCount="1"

POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-v|--version)
Version="$2"
shift # past argument
shift # past value
;;
-p|--package)
Package="$2"
shift # past argument
shift # past value
;;
-c|--class)
Class="$2"
shift # past argument
shift # past value
;;
-m|--methods)
Methods="$2"
shift # past argument
shift # past value
;;
-kc|--keep-going)
KeepGoingCount="$2"
shift # past argument
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done

set -- "${POSITIONAL[@]}" # restore positional parameters

echo "Version = ${Version}"
echo "Package = ${Package}"
echo "Class = ${Class}"

for Method in ${Methods}; do
echo "Fuzzing Method = ${Method}"
docker run --rm -v /"$(pwd)/fuzzing/$Version/$Package/$Class/$Method":/fuzzing cifuzz/jazzer-autofuzz \
io.dapr:dapr-sdk:${Version} \
${Package}.${Class}::${Method} --keep_going=${KeepGoingCount}
done

# store exit status of grep
# if code 77 or 0 fuzzer ran successfully
# if not, something went wrong
status=$?
echo $status
if [ $status -eq 77 ] || [ $status -eq 0 ]
then
echo "Jazzer completed successfully. Artifacts will be available as part of the workflow pipeline"
else
echo "Something went wrong"
fi
50 changes: 50 additions & 0 deletions .github/workflows/jazzer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Run Jazzer against Dapr SDK

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- class: DaprClientBuilder
package: io.dapr.client
methods: 'withObjectSerializer withStateSerializer'
version: 1.3.1
Copy link
Member

Choose a reason for hiding this comment

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

Can the version be picked up automatically from the pom.xml file?

- class: DaprClientGrpc
package: io.dapr.client
methods: 'waitForSidecar publishEvent invokeMethod'
version: 1.3.1
- class: DaprClientHttp
package: io.dapr.client
methods: 'waitForSidecar publishEvent invokeMethod'
version: 1.3.1
- class: DaprHttp
package: io.dapr.client
methods: 'invokeApi publishEvent invokeMethod'
version: 1.3.1
- class: ObjectSerializer
package: io.dapr.client
methods: 'serialize deserialize'
version: 1.3.1

steps:
- uses: actions/checkout@v2
- name: git-bash
run: |
chmod +x ./jazzer.sh
./jazzer.sh --version ${{matrix.version}} --package ${{matrix.package}} --class ${{matrix.class}} --methods ${{matrix.methods}} --keep-going=1
shell: bash
working-directory: .github/workflows

- name: Upload Crash
uses: actions/upload-artifact@v1
if: always()
with:
name: artifacts
path: ./fuzzing