Skip to content

Add fuzz testing for router and OpenAPI#166

Merged
RomanEmreis merged 4 commits into
mainfrom
feature/fuzzing
Mar 7, 2026
Merged

Add fuzz testing for router and OpenAPI#166
RomanEmreis merged 4 commits into
mainfrom
feature/fuzzing

Conversation

@RomanEmreis
Copy link
Copy Markdown
Owner

Summary

  • Added a full cargo-fuzz package under fuzz/ with four initial libFuzzer targets (fuzz_router_match, fuzz_query_decode, fuzz_extractor_typed, fuzz_openapi_gen) and wired them as fuzz binaries in fuzz/Cargo.toml.
  • Implemented deterministic, bounded harnesses:
    • Router target uses structured arbitrary input (method, bounded path, optional host) with MAX_LEN=512.
    • Query target enforces MAX_LEN=1024.
    • Extractor target caps body/header counts (MAX_BODY=4096, MAX_HEADERS=16) and sanitizes header names.
    • OpenAPI target is selector-driven with bounded input (MAX_LEN=256).
  • Added internal fuzz helpers behind a new fuzzing feature to exercise practical internals without full server startup: router matching (Endpoints::find), query parsing/decoding paths, typed JSON extraction on a bounded runtime, and OpenAPI registration/document serialization flows.
  • Exposed the new fuzz helper module via lib.rs, added a fuzzing feature, and excluded fuzz/ from the workspace members so cargo-fuzz works as expected.
  • Added seed corpora for fast-start coverage under fuzz/corpus/* (router/query/extractor/openapi), plus a dedicated FUZZING.md documenting local commands, env settings, limits, and CI behavior.
  • Added GitHub Actions fuzz workflow:
    • PR/build path: nightly toolchain, cargo-fuzz install, cargo +nightly fuzz build, plus smoke runs for router/query.
    • Scheduled nightly path: all four targets with per-target max_len and bounded runtime.
    • ASAN tuning + RSS limits configured in workflow env/args.

Type

  • Bug fix
  • Feature
  • Enhancement
  • Performance
  • Documentation
  • Refactor
  • Security
  • Breaking change

Checklist

  • I added/updated tests where it makes sense
  • I updated docs/examples if needed
  • This change is backwards-compatible (or clearly marked as breaking)
  • I ran formatting/lints locally (if applicable)

@RomanEmreis RomanEmreis self-assigned this Mar 7, 2026
@RomanEmreis RomanEmreis added enhancement New feature or request feature security labels Mar 7, 2026
@RomanEmreis RomanEmreis changed the title Feature/fuzzing Add fuzz testing for router and OpenAPI Mar 7, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6d459c2cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/fuzz.yml Outdated
@RomanEmreis
Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@RomanEmreis RomanEmreis merged commit 2872d32 into main Mar 7, 2026
7 checks passed
@RomanEmreis RomanEmreis deleted the feature/fuzzing branch March 7, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant