fix(js): cap fetched_urls to prevent unbounded heap growth - #711
Open
mnaza wants to merge 1 commit into
Open
Conversation
Every JS fetch()/XHR appended the request URL to ObscuraState.fetched_urls with no eviction, so a page looping fetch() grew the Vec without bound on the process heap (where V8's heap-limit guard never sees it). Every sibling telemetry collection in the struct is already capped; this one was not. Add a push_capped helper (front-drain, keeping the newest, mirroring the js_network_events path) and route the fetched_urls push through it with a 16384-entry cap. fetched_urls only feeds the CLI --dump assets listing, so a bounded most-recent window is sufficient. Closes h4ckf0r0day#705
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.
Every JS
fetch()/XHR appended the request URL toObscuraState.fetched_urlswith no eviction, so a page loopingfetch()grew the Vec without bound on the process heap (where V8's heap-limit guard never sees it). Every sibling telemetry collection is already capped; this one was not.Adds a
push_cappedfront-drain helper (keeps the newest, mirroringjs_network_events) and routes thefetched_urlspush through it with a 16384-entry cap.fetched_urlsonly feeds the CLI--dump assetslisting, so a bounded most-recent window suffices.TDD: RED grew to 10, GREEN caps at 4 keeping the newest.
Closes #705