Repository navigation
test: fuzz the header readers, briefly on every pull request and for ten minutes a week - #9
Merged
Merged
Conversation
…ten minutes a week scripts/fuzz_headers.py takes the hostile corpus's well-formed files as seeds, damages them at random (bit flips, boundary values in length and offset fields, truncation, inserted and deleted runs, duplicated blocks, splices from another seed) and runs the result through the same readers the check uses. Every outcome must be a header or a HeaderError within five seconds; anything else is written to fuzz-findings/ with its traceback, for turning into a test, and the run fails. CI runs it for thirty seconds on one Python; the weekly security run for ten minutes, keeping any findings as an artefact. Both seed it with the run id so a failure can be repeated by hand. Four minutes across four seeds locally, about four and a half million inputs a minute, found nothing. Stage 3 of brief 022. Co-authored-by: Yvette Mankerian <yvettekm@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
# Conflicts: # .gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/fuzz_headers.py: takes the hostile corpus's well-formed files (and, when Pillow is present, files Pillow writes) as seeds, damages them at random and runs each result through the same readers the check uses. Mutations: bit flips, boundary values written into 2- and 4-byte fields in either endian, truncation, inserted and deleted runs, duplicated blocks, splices from another seed. Every outcome must be a header or aHeaderErrorwithin five seconds. Anything else is a finding: the input and its traceback go tofuzz-findings/(git-ignored) and the run exits 1.security.yml, with any findings kept as an artefact. Both are seeded by the run id, passed through the environment, so a failure can be repeated by hand with--seed.tests/test_fuzz.pykeeps the fuzzer itself honest: a short run finds nothing, a reader that raises the wrong thing is recorded as a finding, andmainparses a seed.CONTRIBUTING.mdlists the command among the checks;AGENTS.md's hostile-corpus rule says where findings go.Stage 3 of brief 022 (the fuzzing job).
Test plan
🤖 Generated with Claude Code