Skip to content

fix(scan): capture every chunk in next.js build manifest arrays#345

Open
TBX3D wants to merge 1 commit into
vmfunc:mainfrom
TBX3D:hunt/jsframe
Open

fix(scan): capture every chunk in next.js build manifest arrays#345
TBX3D wants to merge 1 commit into
vmfunc:mainfrom
TBX3D:hunt/jsframe

Conversation

@TBX3D

@TBX3D TBX3D commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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.

@TBX3D
TBX3D requested a review from vmfunc as a code owner July 9, 2026 22:12
@github-actions github-actions Bot added size/m <200 lines changed scan changes to scan engine modules changes to scan modules tests test changes and removed size/m <200 lines changed labels Jul 9, 2026
@codecov-commenter

codecov-commenter commented Jul 9, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@7ea1cd2). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

pr summary

2 files changed (+91 -4)

category files
go source 2
tests 1

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.
@github-actions github-actions Bot added the size/m <200 lines changed label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modules changes to scan modules scan changes to scan engine size/m <200 lines changed tests test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants