From 925cbd2ce03bbbd12dba65017cb77c63e26fc56c Mon Sep 17 00:00:00 2001 From: ebell495 Date: Tue, 24 May 2022 15:34:05 -0700 Subject: [PATCH 1/7] Integrate Mayhem --- .github/workflows/mayhem.yml | 64 ++++++++++++++++++++++++++++++++++++ Dockerfile | 7 ++++ Mayhemfile | 10 ++++++ fuzz/fuzz.py | 17 ++++++++++ 4 files changed, 98 insertions(+) create mode 100644 .github/workflows/mayhem.yml create mode 100644 Dockerfile create mode 100644 Mayhemfile create mode 100644 fuzz/fuzz.py diff --git a/.github/workflows/mayhem.yml b/.github/workflows/mayhem.yml new file mode 100644 index 00000000..a437de8b --- /dev/null +++ b/.github/workflows/mayhem.yml @@ -0,0 +1,64 @@ +name: Mayhem +on: + push: + pull_request: + workflow_dispatch: + workflow_call: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + name: ${{ matrix.os }} shared=${{ matrix.shared }} ${{ matrix.build_type }} + runs-on: ${{ matrix.os }} + permissions: + packages: write + contents: write + security-events: write + + strategy: + matrix: + os: [ubuntu-latest] + shared: [false] + build_type: [Release] + include: + - os: ubuntu-latest + triplet: x64-linux + + steps: + - uses: actions/checkout@v2 + + - 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: + 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 }} --duration 300 + sarif-output: sarif + + - name: Upload SARIF file(s) + uses: github/codeql-action/upload-sarif@v1 + with: + sarif_file: sarif \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..281fda1c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.8-bullseye +RUN pip3 install atheris + +COPY . /html5lib +WORKDIR /html5lib +RUN python3 -m pip install -r requirements.txt +RUN python3 -m pip install . && chmod +x fuzz/fuzz.py \ No newline at end of file diff --git a/Mayhemfile b/Mayhemfile new file mode 100644 index 00000000..3d02a7a9 --- /dev/null +++ b/Mayhemfile @@ -0,0 +1,10 @@ +project: html5lib-python +target: html5lib-python +image: ghcr.io/ebell495/html5lib-python:latest +duration: 300 + +tests: null + +cmds: + - cmd: fuzz/fuzz.py + libfuzzer: true \ No newline at end of file diff --git a/fuzz/fuzz.py b/fuzz/fuzz.py new file mode 100644 index 00000000..8c51ecdd --- /dev/null +++ b/fuzz/fuzz.py @@ -0,0 +1,17 @@ +#!/usr/local/bin/python3 +import atheris +import sys + +with atheris.instrument_imports(): + import html5lib + + +@atheris.instrument_func +def TestOneInput(data): + fdp = atheris.FuzzedDataProvider(data) + html5lib.parse(fdp.ConsumeString(len(data))) + + +# atheris.instrument_all() +atheris.Setup(sys.argv, TestOneInput) +atheris.Fuzz() \ No newline at end of file From 86709138b4912a94357f39ce1446ec1e58f88fc7 Mon Sep 17 00:00:00 2001 From: Eric Bell <48191180+ebell495@users.noreply.github.com> Date: Sun, 29 May 2022 15:31:51 -0700 Subject: [PATCH 2/7] Update Mayhemfile --- Mayhemfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Mayhemfile b/Mayhemfile index 3d02a7a9..a4dbe979 100644 --- a/Mayhemfile +++ b/Mayhemfile @@ -1,10 +1,7 @@ project: html5lib-python -target: html5lib-python -image: ghcr.io/ebell495/html5lib-python:latest -duration: 300 - +target: fuzz tests: null cmds: - cmd: fuzz/fuzz.py - libfuzzer: true \ No newline at end of file + libfuzzer: true From 319176b9497924aa2a3724512b5ee8fb740bb753 Mon Sep 17 00:00:00 2001 From: Eric Bell <48191180+ebell495@users.noreply.github.com> Date: Thu, 16 Jun 2022 23:12:03 -0700 Subject: [PATCH 3/7] Update Mayhemfile --- Mayhemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Mayhemfile b/Mayhemfile index a4dbe979..91a83bd7 100644 --- a/Mayhemfile +++ b/Mayhemfile @@ -1,6 +1,5 @@ project: html5lib-python target: fuzz -tests: null cmds: - cmd: fuzz/fuzz.py From ffacc1bde23bb4358a1aedc78c1e2614251cab32 Mon Sep 17 00:00:00 2001 From: ebell495 Date: Sun, 24 Jul 2022 18:19:47 -0700 Subject: [PATCH 4/7] Rename Fuzz Harness --- Dockerfile | 2 +- Mayhemfile | 4 ++-- fuzz/{fuzz.py => fuzz_html_parser.py} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename fuzz/{fuzz.py => fuzz_html_parser.py} (100%) diff --git a/Dockerfile b/Dockerfile index 281fda1c..84395c81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,4 +4,4 @@ RUN pip3 install atheris COPY . /html5lib WORKDIR /html5lib RUN python3 -m pip install -r requirements.txt -RUN python3 -m pip install . && chmod +x fuzz/fuzz.py \ No newline at end of file +RUN python3 -m pip install . && chmod +x fuzz/fuzz_html_parser.py \ No newline at end of file diff --git a/Mayhemfile b/Mayhemfile index 91a83bd7..d0ea9290 100644 --- a/Mayhemfile +++ b/Mayhemfile @@ -1,6 +1,6 @@ project: html5lib-python -target: fuzz +target: fuzz_html_parser cmds: - - cmd: fuzz/fuzz.py + - cmd: fuzz/fuzz_html_parser.py libfuzzer: true diff --git a/fuzz/fuzz.py b/fuzz/fuzz_html_parser.py similarity index 100% rename from fuzz/fuzz.py rename to fuzz/fuzz_html_parser.py From 90c81277b2c607aeaa75b24cacdea2e36d5eadd3 Mon Sep 17 00:00:00 2001 From: Aziz Rizayev Date: Mon, 27 Apr 2026 17:53:43 +0000 Subject: [PATCH 5/7] fix: update github actions versions and mcode-action to long-runs --- .github/workflows/mayhem.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/mayhem.yml b/.github/workflows/mayhem.yml index a437de8b..e985ad8a 100644 --- a/.github/workflows/mayhem.yml +++ b/.github/workflows/mayhem.yml @@ -28,10 +28,10 @@ jobs: triplet: x64-linux steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -39,12 +39,12 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v5 with: context: . push: true @@ -56,9 +56,3 @@ jobs: with: mayhem-token: ${{ secrets.MAYHEM_TOKEN }} args: --image ${{ steps.meta.outputs.tags }} --duration 300 - sarif-output: sarif - - - name: Upload SARIF file(s) - uses: github/codeql-action/upload-sarif@v1 - with: - sarif_file: sarif \ No newline at end of file From 9f7ac7600287a9ad2052c7697ba23d60433cbf7c Mon Sep 17 00:00:00 2001 From: Aziz Rizayev Date: Mon, 27 Apr 2026 18:18:33 +0000 Subject: [PATCH 6/7] fix: update mcode-action to long-runs --- .github/workflows/mayhem.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mayhem.yml b/.github/workflows/mayhem.yml index e985ad8a..55f2c0de 100644 --- a/.github/workflows/mayhem.yml +++ b/.github/workflows/mayhem.yml @@ -52,7 +52,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} - name: Start analysis - uses: ForAllSecure/mcode-action@v1 + uses: forallsecure/mcode-action@long-runs with: mayhem-token: ${{ secrets.MAYHEM_TOKEN }} args: --image ${{ steps.meta.outputs.tags }} --duration 300 From b90a7da245191fb190be368a3b80cf3ebcfaa631 Mon Sep 17 00:00:00 2001 From: Azizjon Rizayev Date: Thu, 4 Jun 2026 19:57:04 +0000 Subject: [PATCH 7/7] Fix Docker build: switch to python:3.11-slim + clang for atheris; update action versions --- .github/workflows/mayhem.yml | 11 +++++++---- Dockerfile | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mayhem.yml b/.github/workflows/mayhem.yml index 55f2c0de..65ae96e0 100644 --- a/.github/workflows/mayhem.yml +++ b/.github/workflows/mayhem.yml @@ -28,10 +28,10 @@ jobs: triplet: x64-linux steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6.0.2 - name: Log in to the Container registry - uses: docker/login-action@v3 + uses: docker/login-action@v4.1.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -39,12 +39,15 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@v6.0.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4.0.0 + - name: Build and push Docker image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v7.1.0 with: context: . push: true diff --git a/Dockerfile b/Dockerfile index 84395c81..c1594017 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ -FROM python:3.8-bullseye +FROM python:3.11-slim + +RUN apt-get update && apt-get install -y clang && rm -rf /var/lib/apt/lists/* RUN pip3 install atheris COPY . /html5lib WORKDIR /html5lib RUN python3 -m pip install -r requirements.txt -RUN python3 -m pip install . && chmod +x fuzz/fuzz_html_parser.py \ No newline at end of file +RUN python3 -m pip install . && chmod +x fuzz/fuzz_html_parser.py