Skip to content

feat(fuzz): add jq_fuzz target for jq builtin#1111

Merged
chaliy merged 1 commit intomainfrom
feat/issue-1094-jq-fuzz
Apr 6, 2026
Merged

feat(fuzz): add jq_fuzz target for jq builtin#1111
chaliy merged 1 commit intomainfrom
feat/issue-1094-jq-fuzz

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 6, 2026

Summary

  • Add fuzz target for the jq builtin (~1572 LOC) which has a complex custom filter expression parser (jaq) processing arbitrary JSON data
  • Target splits fuzz input into filter expression (first line) and JSON data (remainder)
  • Exercises both jq '<filter>' and jq -r '<filter>' through the full interpreter with tight resource limits
  • Includes depth-limiting filter to reject deeply nested expressions

Changes

  • New fuzz/fuzz_targets/jq_fuzz.rs: fuzz target
  • Updated fuzz/Cargo.toml: added [[bin]] entry for jq_fuzz
  • New tests/jq_fuzz_scaffold_tests.rs: 5 scaffold tests (valid filter, malformed JSON, invalid filter, deep nesting, null bytes)

Test plan

  • cargo test --test jq_fuzz_scaffold_tests — 5 tests pass
  • cargo clippy --all-targets --all-features -- -D warnings — clean
  • cargo fmt --check — clean

Closes #1094

Add fuzz target for the jq builtin which has a complex custom filter
expression parser (jaq) processing arbitrary JSON data — high crash
and ReDoS risk.

The target splits fuzz input into a filter expression (first line) and
JSON data (remainder), then exercises the jq builtin through the
interpreter with tight resource limits.

Includes scaffold tests validating the jq builtin handles valid filters,
malformed JSON, invalid filters, deeply nested expressions, and null
bytes without panicking.

Closes #1094
@chaliy chaliy merged commit 182ce60 into main Apr 6, 2026
18 checks passed
@chaliy chaliy deleted the feat/issue-1094-jq-fuzz branch April 6, 2026 10:45
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.

fuzz: add jq_fuzz target

1 participant