fix(scan): capture every chunk in next.js build manifest arrays#345
Open
TBX3D wants to merge 1 commit into
Open
fix(scan): capture every chunk in next.js build manifest arrays#345TBX3D wants to merge 1 commit into
TBX3D wants to merge 1 commit into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #345 +/- ##
=======================================
Coverage ? 54.81%
=======================================
Files ? 81
Lines ? 6874
Branches ? 0
=======================================
Hits ? 3768
Misses ? 2839
Partials ? 267 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pr summary2 files changed (+91 -4)
|
the manifest maps each route to an array of chunk paths, but the regex anchored on the opening bracket so only the first .js literal per array was captured, dropping the remaining chunks from the script list. match each quoted chunk path instead, scoped to the relative static/ shape (literal or escaped slash) so non-chunk .js strings such as __rewrites destinations, which can be attacker-controlled absolute urls, are not pulled into the fetch list.
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.
the pages-router build manifest regex anchored on the opening bracket of each route's chunk array, so it only ever captured the first chunk and silently dropped the rest whenever a route referenced more than one. tightened the regex to match every relative static/ chunk path instead of anchoring on the array boundary, without loosening it to a bare quoted-.js match, which would also pull in non-chunk strings such as __rewrites destinations (potentially an attacker-controlled absolute url). adds a realistic manifest fixture with shared IIFE-arg chunks and rewrite/sortedPages decoys to pin both the fix and the anti-fp behavior.