fix(review): bound theme storage writes - #4177
Merged
Merged
Conversation
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4177 +/- ##
=======================================
Coverage 93.72% 93.72%
=======================================
Files 385 385
Lines 36243 36249 +6
Branches 13281 13284 +3
=======================================
+ Hits 33968 33974 +6
Misses 1618 1618
Partials 657 657
🚀 New features to boost your workflow:
|
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 Gittensory is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
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.
Motivation
page.evaluatewithout a local timeout, allowing a hostile page to monkey-patchlocalStorage.setItemand hang screenshot/scroll-render workers (availability DoS).Description
forceThemeStorage(page, storageKey, storageValue)that races thepage.evaluatelocalStorage write against a 2s timeout and logsrender_theme_storage_write_timeoutwhen it times out.captureShotandcaptureScrollFramesso the code degrades (returns null frames/png) instead of awaiting a potentially stalled evaluate beforepage.reload.THEME_STORAGE_WRITE_TIMEOUT_MSconstant and broaden theScreenshotPage.evaluatetype signature to accept argumented callbacks, and include regression tests exercising the timed-out write path for both capture modes.Testing
npx vitest run test/unit/visual-shot.test.ts; all tests passed (58/58) and the new regression tests exercised the timeout behavior.npm run typecheckandgit diff --check, both succeeded locally.npm audit --audit-level=moderatecould not complete in this environment (registry returned 403).npm run test:coverage ...but the coverage reporter crashed withTypeError: jsTokens is not a functiondespite the tests themselves passing; the functional behavior guarded by the new tests is validated.Codex Task