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

Bump github/codeql-action from 1 to 2 #3

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
64 changes: 64 additions & 0 deletions .github/workflows/mayhem.yml
Original file line number Diff line number Diff line change
@@ -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@v2
with:
sarif_file: sarif
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.8-bullseye
RUN pip3 install atheris

COPY . /fickling
WORKDIR /fickling
RUN python3 -m pip install . && chmod +x fuzz/fuzz_pickle_decompiler.py
9 changes: 9 additions & 0 deletions Mayhemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
project: fickling
target: fuzz_pickle_decompiler

testsuite:
- file://./fuzz/fuzz_corpus

cmds:
- cmd: fuzz/fuzz_pickle_decompiler.py
libfuzzer: true
Binary file added fuzz/fuzz_corpus/1.pickle
Binary file not shown.
Binary file added fuzz/fuzz_corpus/2.pickle
Binary file not shown.
Binary file added fuzz/fuzz_corpus/3.pickle
Binary file not shown.
23 changes: 23 additions & 0 deletions fuzz/fuzz_pickle_decompiler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/local/bin/python3
from random import random
from textwrap import indent
import atheris
import sys
import io
import os
import random

with atheris.instrument_imports():
import ast
from fickling.pickle import Pickled

@atheris.instrument_func
def TestOneInput(data):
try:
Pickled.load(data)
except ValueError:
pass


atheris.Setup(sys.argv, TestOneInput)
atheris.Fuzz()