Nightly fuzzing on cnx01: text, uploads, the signed copy
CI / secret scan (push) Successful in 6s
CI / fmt, clippy, tests (push) Successful in 1m20s
CI / release (push) Skipped

.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:
grabowski committed 2026-11-23 10:01:02 +07:00
1 parent 7b5ec35e7c
commit 9b4d73c94b
38 files changed
+376 -16

No files matched your search

+15 -10
View File
@@ -736,16 +736,21 @@ cases in the tests.
the contract diff, the journal hash, and the PDF's line wrap. Their first
run found that the photo reader dropped a one-letter given name (the K of
SMITH<<K); fixed in `mrz::first_line`.
- [ ] Coverage-guided fuzzing every night (cargo-fuzz on nightly): uploaded
JPEG, PNG and WebP files through the pack's image code, uploaded PDFs
through krilla, the drawn signature's PNG, the passport zone, the
version form's multipart reader. Seed files from the demo data, the
grown corpus in the runner's cache, a crash fails the job with its input
as an artifact, and each crash becomes a case under `tests/fuzz_cases/`
that `cargo test` replays on every push.
- [ ] The nightly job runs only on the runner on hel01 (a label such as
`heavy` in cnx-network-clan), so fuzzing never takes cores from cnx01,
where the app runs.
- [x] Coverage-guided fuzzing every night (`.gitea/workflows/fuzz.yml`,
cargo-fuzz on nightly Rust, 10 minutes a target): `text` (passport zones
and OCR output, positions, names, dates, agreement and contract texts),
`upload` (JPEG, PNG, WebP and PDF files through the pack's image and PDF
code, as the Documents tab prints them) and `signed_copy` (the drawn
signature's PNG and the agreement text in the signed copy). Their bodies
are in `src/fuzzing.rs`; `fuzz/seeds/` has small real files to start
from, the grown corpus stays in the runner's cache, a crash fails the job
with its input as the artifact `fuzz-findings`, and each one goes into
`tests/fuzz_cases/<target>/` with its fix, which `cargo test` replays on
every push. The multipart reading itself is axum's (multer), so no
target of ours.
- [ ] The nightly job runs on runner02 on cnx01 (Alex, Nov 23, 2026), by
its own label `cnx01` (cnx-network-clan PR), at 03:00 and at the lowest
CPU priority (`nice`), so the app keeps first call on the CPU.
## Open questions