Bug in WebExtension DNR "initiatorDomains" condition
Categories
(WebExtensions :: Request Handling, defect)
Tracking
(firefox-esr115 unaffected, firefox-esr128 fixed, firefox133 wontfix, firefox134 wontfix, firefox135 fixed, firefox136 fixed)
People
(Reporter: arkadiyt, Assigned: arkadiyt)
References
(Regression)
Details
(Keywords: regression)
Attachments
(3 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-esr128+
|
Details | Review |
Steps to reproduce:
Firefox supports WebExtension DNR conditions such as initiatorDomains, excludeInitiatorDomains, requestDomains, and excludeRequestDomains:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest
This logic is implemented here: https://searchfox.org/mozilla-central/source/toolkit/components/extensions/ExtensionDNR.sys.mjs
Recently this commit merged to try to optimize the speed of matching rule conditions: https://phabricator.services.mozilla.com/D212691
The way that it works is:
- for a given e.g. initiatorDomain, construct the list of superdomains of it. For instance for "sub.example.com" construct the list ["sub.example.com", "example.com", "com"]
- when evaluating a rule, check that any of the initiatorDomains match against any of the list of superdomains
Unfortunately there is a bug in the list of superdomains due to a shadowed variable:
https://searchfox.org/mozilla-central/source/toolkit/components/extensions/ExtensionDNR.sys.mjs#1512-1526
In particular we have:
> getAllDomainsWithin('signin.aws.amazon.com')
[ 'signin.aws.amazon.com', 'aws.amazon.com', 'com' ]
Notice that it is missing amazon.com
.
This is causing rules to not match in the extension that I'm writing
Actual results:
getAllDomainsWithin('signin.aws.amazon.com')
is missing `amazon.com``
Expected results:
getAllDomainsWithin('signin.aws.amazon.com')
should contain amazon.com
Assignee | ||
Comment 1•2 months ago
|
||
Updated•2 months ago
|
Comment 2•2 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'WebExtensions::Request Handling' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•2 months ago
|
||
This also affects requestDomains, not just initiatorDomains, as it shares the same logic.
Updated•2 months ago
|
Updated•2 months ago
|
Comment 5•2 months ago
|
||
bugherder |
Comment 6•2 months ago
|
||
The patch landed in nightly and beta is affected.
:arkadiyt, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox135
towontfix
.
For more information, please visit BugBot documentation.
Comment 8•2 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D233223
Updated•2 months ago
|
Comment 9•2 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D233223
Updated•2 months ago
|
Comment 10•2 months ago
|
||
beta Uplift Approval Request
- User impact if declined: Some extension-specified declarative network rule conditions may fail to apply. E.g. network requests that should be blocked may unexpectedly be allowed.
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: Not needed; covered by automated unit tests
- Risk associated with taking this patch: Low
- Explanation of risk level: Fixes logical error, with unit tests
- String changes made/needed: None
- Is Android affected?: yes
Comment 11•2 months ago
|
||
esr128 Uplift Approval Request
- User impact if declined: Some extension-specified declarative network rule conditions may fail to apply. E.g. network requests that should be blocked may unexpectedly be allowed.
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: Not needed; covered by automated unit tests
- Risk associated with taking this patch: Low
- Explanation of risk level: Fixes logical error, with unit tests
- String changes made/needed: None
- Is Android affected?: yes
Updated•2 months ago
|
Updated•2 months ago
|
Comment 12•2 months ago
|
||
uplift |
Updated•2 months ago
|
Updated•2 months ago
|
Comment 13•2 months ago
|
||
uplift |
Updated•2 months ago
|
Description
•