test: add fuzzing coverage for incoming packet parsing - #1829
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1829 +/- ##
==========================================
+ Coverage 99.81% 99.86% +0.05%
==========================================
Files 33 33
Lines 3839 3839
Branches 553 553
==========================================
+ Hits 3832 3834 +2
+ Misses 5 3 -2
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
bluetoothbot
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
There was a problem hiding this comment.
Pull request overview
Adds reproducible Hypothesis fuzz coverage for DNSIncoming packet parsing.
Changes:
- Tests malformed, mutated, truncated, compressed-name, and NSEC inputs.
- Configures bounded CI and extended local fuzzing profiles.
- Adds Hypothesis and ignores its generated state.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_fuzz_incoming.py |
Adds parser fuzz tests and valid-packet controls. |
tests/conftest.py |
Configures Hypothesis profiles and optional collection. |
pyproject.toml |
Adds the Hypothesis development dependency. |
poetry.lock |
Locks Hypothesis and its dependency. |
.gitignore |
Ignores Hypothesis state. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
PR Review — test: add fuzzing coverage for incoming packet parsingAll six findings from the previous round are addressed; what remains are two nits. Merge-ready. The follow-up commit is a clean response rather than a minimal one: the Hypothesis profile registration moved into I re-verified the two properties the suite leans on:
✅ Resolved since last review (6)Previously-flagged issues verified fixed
🟢 Suggestions
1. `_parse` misses `repr(incoming)` and the production constructor shape
|
bluetoothbot
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
Summary
Adds hypothesis based fuzzing for
DNSIncomingahead of planned parser performance work; the constructor contract is that any byte sequence parses or fails quietly withvalid = False, never raising.Details
tests/test_fuzz_incoming.pycovers raw garbage, mutated and truncated valid packets, spliced compression pointers, adversarial name sections built from label and pointer tokens, and NSEC bitmap mutations; every parsed record is also touched via repr and hash, and a positive control pins that the corpus itself parses fullyHYPOTHESIS_PROFILE=longdeep runs, which are manual for nowhypothesisjoins the dev dependency group;.hypothesis/is gitignoredTest plan
poetry run pytest testspasses, 490 passedHYPOTHESIS_PROFILE=longrun, 50k examples per test, no failures