Repository navigation
Fuzz the lockfile parsers; fix crashes on hostile lockfiles - #2
Merged
Merged
Conversation
A package-lock.json that's a JSON array, has non-object entries, numeric versions, or is nested a few thousand levels deep made lock_deps raise (AttributeError / RecursionError, the latter even inside json.loads), and projects() had no guard, so one bad lockfile anywhere in the projects folder stopped malware and CVE checks for every project. - Type-check everything read from package-lock.json; walk v1 dependencies iteratively; loads() treats RecursionError as unreadable - projects() skips (and logs) a lockfile it can't parse - Atheris fuzz targets for the six lockfile parsers (seeded corpus) and the projects-folder check; a Fuzz CI job runs them on Linux with a per-input timeout and keeps crashing inputs as artifacts - Regression tests for the crash cases and the seed lockfiles
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.
Found while adding fuzzing: a malformed
package-lock.json(top-level array, non-object entries, numeric versions, or deep nesting) crashedlock_deps, and sinceprojects()had no guard, one bad lockfile stopped the scan and audit for every project. Fixed (type checks, iterative walk,RecursionErrorhandled, per-file skip), with regression tests, plus Atheris fuzz targets and a Fuzz CI job (Linux).