Mitigate security risk: content script access to chrome.storage.sync#62
Mitigate security risk: content script access to chrome.storage.sync#62
Conversation
- Background: Migrated runtime options authority to `chrome.storage.session` and internal state. - Background: Removed `chrome.storage.onChanged` listener for options to prevent content script tampering. - Background: Added `updateOptions` message handler to receive trusted updates from extension pages. - Options: Updated options page to send `updateOptions` messages instead of writing directly to `chrome.storage.sync`. - This ensures that only trusted extension pages can modify the extension's configuration. Co-authored-by: NDevTK <31563761+NDevTK@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This PR mitigates a security risk where
chrome.storage.syncwas accessible to website content scripts, potentially allowing malicious sites to modify extension settings.Changes:
background.js:restore()to prioritize loading settings fromchrome.storage.session(trusted runtime storage).chrome.storage.onChangedlistener foroptionsandexcludekeys, effectively ignoring direct storage writes from untrusted sources (content scripts).updateOptionsmessage handler that verifies the sender is a trusted extension page before updating state and storage.toggleOptionto sync internal changes tochrome.storage.session.options.js:chrome.storage.sync.setcalls with a newsendUpdatefunction that sendsupdateOptionsmessages to the background script.This architecture ensures that while
chrome.storage.syncis still used for persistence and syncing, the authoritative runtime state is protected, and updates are validated.PR created automatically by Jules for task 1381566129880040394 started by @NDevTK