From f2c3709806532522d5f21b6167aac73b8ac21a7a Mon Sep 17 00:00:00 2001 From: Raj Shah Date: Sun, 22 May 2022 06:56:00 +0000 Subject: [PATCH] Integrate Mayhem --- .github/workflows/mayhem.yml | 62 ++++++++++++++++++++++++++++++++++++ Dockerfile.mayhem | 11 +++++++ Mayhemfile | 6 ++++ 3 files changed, 79 insertions(+) create mode 100644 .github/workflows/mayhem.yml create mode 100644 Dockerfile.mayhem create mode 100644 Mayhemfile diff --git a/.github/workflows/mayhem.yml b/.github/workflows/mayhem.yml new file mode 100644 index 00000000..c5b8eee8 --- /dev/null +++ b/.github/workflows/mayhem.yml @@ -0,0 +1,62 @@ +name: Mayhem +on: + push: + pull_request: + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + permissions: write-all + name: '${{ matrix.os }} shared=${{ matrix.shared }} ${{ matrix.build_type }}' + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + shared: [false] + build_type: [Release] + include: + - os: ubuntu-latest + triplet: x64-linux + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + file: ./Dockerfile.mayhem + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Start analysis + uses: ForAllSecure/mcode-action@v1 + with: + mayhem-token: ${{ secrets.MAYHEM_TOKEN }} + args: --image ${{ steps.meta.outputs.tags }} + sarif-output: sarif + + - name: Upload SARIF file(s) + uses: github/codeql-action/upload-sarif@v1 + with: + sarif_file: sarif diff --git a/Dockerfile.mayhem b/Dockerfile.mayhem new file mode 100644 index 00000000..804dc330 --- /dev/null +++ b/Dockerfile.mayhem @@ -0,0 +1,11 @@ +FROM --platform=linux/amd64 ubuntu:20.04 + +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential automake libtool pkg-config bison flex + +ADD . /repo +WORKDIR /repo +RUN libtoolize -qi +RUN autoreconf +RUN ./configure +RUN make diff --git a/Mayhemfile b/Mayhemfile new file mode 100644 index 00000000..b7831135 --- /dev/null +++ b/Mayhemfile @@ -0,0 +1,6 @@ +project: rnshah9/es-shell +target: es-shell +image: ghcr.io/rnshah9/playground:es-shell + +cmds: + - cmd: /repo/es @@