Skip to content

feat: fuzz testing infrastructure + Timespan::parse fix#70

Merged
mostafa merged 6 commits into
mainfrom
feat/fuzz-testing
May 5, 2026
Merged

feat: fuzz testing infrastructure + Timespan::parse fix#70
mostafa merged 6 commits into
mainfrom
feat/fuzz-testing

Conversation

@mostafa
Copy link
Copy Markdown
Member

@mostafa mostafa commented May 5, 2026

Summary

  • Add 7 cargo-fuzz harnesses covering all untrusted input surfaces: YAML parsing, condition expressions, field modifiers/timespan, JSON event matching, regex compilation, pipeline YAML, and input formats (syslog/CEF/logfmt).
  • Fix two panics in Timespan::parse discovered by the fuzzer: string slicing on non-char boundary with multibyte UTF-8, and integer overflow in duration calculation.
  • Add weekly CI workflow with per-target corpus caching and crash artifact upload.

Test plan

  • All 7 fuzz targets build and run without crashes (validated locally with 15-60s runs each)
  • cargo test --workspace passes (11 value tests including 2 new regression tests)
  • cargo clippy --workspace --all-targets --all-features -- -D warnings clean
  • fuzz_field_modifiers confirmed to no longer crash on the original reproducer inputs
  • CI workflow runs successfully on first scheduled trigger (Monday 03:00 UTC)

mostafa added 3 commits May 5, 2026 20:08
7 fuzz targets covering parser (YAML, conditions, field modifiers),
eval (JSON event matching, regex compilation, pipeline YAML), and
runtime (syslog/CEF/logfmt/auto input formats). Includes seed corpora,
weekly CI workflow, and per-target max_len configuration.

Roadmap item 8b.
Two issues found by fuzz_field_modifiers:

1. `split_at(s.len() - 1)` panics on multibyte UTF-8 because byte
   length != char count. Fixed by splitting at the last char boundary
   via `char_indices().next_back()`.

2. `count * multiplier` overflows for large numeric values, panicking
   in debug builds and silently wrapping in release. Fixed with
   `checked_mul` that returns InvalidTimespan on overflow.
Move hand-crafted seeds to fuzz/seeds/ (tracked) and gitignore
fuzz/corpus/ (generated at runtime, cached in CI). This keeps the
repo clean while preserving meaningful starting inputs.
Comment thread .github/workflows/fuzz.yml Fixed
Comment thread .github/workflows/fuzz.yml Fixed
Comment thread .github/workflows/fuzz.yml Fixed
Comment thread .github/workflows/fuzz.yml Fixed
Comment thread .github/workflows/fuzz.yml Fixed
Comment thread .github/workflows/fuzz.yml Fixed
Comment thread .github/workflows/fuzz.yml Fixed
Comment thread .github/workflows/fuzz.yml Fixed
mostafa added 3 commits May 5, 2026 20:22
These build artifacts were accidentally committed; already covered
by fuzz/.gitignore.
- Move matrix.target, matrix.max_len, and github.event.inputs.duration
  to step-level env vars to avoid template injection in run blocks.
- Add concurrency group to prevent duplicate scheduled runs.
Resolves the last zizmor superfluous-actions finding; the runner
already ships rustup so we use it directly.
@mostafa mostafa merged commit 43f2328 into main May 5, 2026
12 checks passed
@mostafa mostafa deleted the feat/fuzz-testing branch May 5, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants