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

Build image #28

Merged
merged 3 commits into from
Aug 22, 2023
Merged
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
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ jobs:

- name: test
run: cargo test

test-build-image:
if: "!startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
push: false
42 changes: 42 additions & 0 deletions .github/workflows/publish-container-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: publish-container-images

on:
push:
tags:
- "v*"

env:
REGISTRY: ghcr.io

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}

- name: Build and push Docker image
if: "startsWith(github.ref, 'refs/tags/')"
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM messense/rust-musl-cross:x86_64-musl as builder

WORKDIR /openapi-fuzzer
COPY . /openapi-fuzzer
RUN cargo build --release --target x86_64-unknown-linux-musl

FROM scratch
COPY --from=builder openapi-fuzzer/target/x86_64-unknown-linux-musl/release/openapi-fuzzer /openapi-fuzzer
ENTRYPOINT ["/openapi-fuzzer"]
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ The category of bugs differ, but some of the common are parsing bugs, invalid fo

## Building & installing

### From crates.io

To build the fuzzer, you will need to have [rust installed](https://www.rust-lang.org/learn/get-started).

```sh
# Install from crates.io
cargo install openapi-fuzzer
```

# Or download the repo and build locally
### From source

```sh
git clone [email protected]:matusf/openapi-fuzzer.git
cd openapi-fuzzer

Expand All @@ -55,6 +59,12 @@ cargo install --path .
cargo build --release
```

### Using containers

```sh
podman pull ghcr.io/matusf/openapi-fuzzer
```

## Usage

After installation you will have the `openapi-fuzzer` binary available to you, which offers two subcommands - `run` and `resend`. The `run` subcommand will fuzz the API according to the specification and report any findings. All findings will be stored in a JSON format in a `results` directory (the name of the directory can be specified by `--results-dir` flag).
Expand Down