Nightly fuzzing on cnx01: text, uploads, the signed copy
.gitea/workflows/fuzz.yml runs cargo-fuzz (libFuzzer, nightly Rust) at 03:00 Chiang Mai time on runner02 on cnx01 (runs-on: cnx01; the label comes with cnx-network-clan PR #170), 10 minutes a target, under nice -n 19 (.gitea/scripts/fuzz.sh). Targets, bodies in src/fuzzing.rs: - text: passport zones and OCR output (whatever from_ocr returns must parse), positions, names, dates, Thai numbers, agreement texts and the contract diff. - upload: a file as files::sniff types it, through the pack's image and PDF code to a finished A4 page (pack::pdf::sides), EXIF orientation. - signed_copy: the drawn signature's PNG, or any text as the agreement, in the signed copy's PDF. fuzz/seeds/ holds small real files to start from (JPEG with JFIF and EXIF, PNG with pHYs, palette PNG, WebP lossy and lossless, A4 and landscape PDF, a drawn signature, zone, OCR, map links, Thai names). The grown corpus stays in the runner's cache; a crash fails the job and leaves its input as the artifact fuzz-findings, which goes into tests/fuzz_cases/<target>/ with the fix. tests/fuzz_cases.rs replays those and the seeds on every push, on stable. No sanitizer (safe Rust, about three times the inputs), debug assertions on, 10 s and 2 GB per input count as findings. DRAWING_LIMIT moved to agreements so the target uses the client page's limit. A local run of 60 s each in a Linux container: 635,522 / 9,763 / 4,089 inputs, peak 62 MB, nothing found.
This commit is contained in:
1 parent
7b5ec35e7c
commit
9b4d73c94b
38 files changed
+376
-16
No files matched your search
@@ -0,0 +1,63 @@
|
||||
# Nightly fuzzing (cargo-fuzz, libFuzzer) of the code that reads what
|
||||
# reaches the app from outside: what people paste and type, uploaded
|
||||
# images and PDFs, the drawn signature (src/fuzzing.rs, fuzz/). Only on
|
||||
# runner02 on cnx01 (label cnx01, cnx-network-clan docs/src/ci-runner.md),
|
||||
# at 03:00 in Chiang Mai and at the lowest CPU priority, so the services
|
||||
# there keep first call. The corpus each run grows is kept in the cache
|
||||
# for the next. A crash fails the job and leaves its input as the artifact
|
||||
# fuzz-findings; it goes into tests/fuzz_cases/<target>/ with the fix,
|
||||
# which every push then replays. Never releases anything.
|
||||
name: Fuzz
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 20 * * *"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
seconds:
|
||||
description: Seconds per target
|
||||
default: "600"
|
||||
|
||||
concurrency:
|
||||
group: fuzz
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_INCREMENTAL: "0"
|
||||
|
||||
jobs:
|
||||
fuzz:
|
||||
name: fuzz
|
||||
runs-on: cnx01
|
||||
timeout-minutes: 120
|
||||
env:
|
||||
FUZZ_SECONDS: ${{ inputs.seconds || '600' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Nightly Rust and cargo-fuzz
|
||||
run: bash .gitea/scripts/fuzz.sh setup
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/cargo-fuzz
|
||||
~/.cargo/registry/index
|
||||
~/.cargo/registry/cache
|
||||
fuzz/target
|
||||
fuzz/corpus
|
||||
# a new key each run, so the grown corpus is saved every night
|
||||
key: fuzz-${{ github.run_id }}
|
||||
restore-keys: fuzz-
|
||||
|
||||
- name: Fuzz
|
||||
run: bash .gitea/scripts/fuzz.sh run
|
||||
|
||||
- name: Keep the findings
|
||||
if: failure()
|
||||
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: fuzz-findings
|
||||
path: fuzz/artifacts/
|
||||
retention-days: 30
|
||||
Reference in new issue
Block a user