Consider removing security.data_uri.block_toplevel_data_uri_navigations pref
Categories
(Core :: DOM: Security, task)
Tracking
()
People
(Reporter: gregp, Assigned: Joe)
References
(Blocks 3 open bugs)
Details
(Keywords: leave-open, Whiteboard: [domsecurity-backlog], [wptsync upstream])
Attachments
(1 file)
It's been enabled by default for about 7 years now (bug 1401895). Ignoring tests, is this pref still necessary?
Comment 1•2 years ago
|
||
If we need to chunk this down we could remove the pref from StaticPrefs (and thus about:config) but use the dynamic pref service to check for a non-default value. That would keep the tests working, and data: navigations are extremely uncommon (because we block them by default!) so the slower lookup wouldn't add any performance trouble.
If we don't want to do that but want to completely remove the pref, we must carefully check all the tests that set the value to false rather than simply toss them. Some might be obsolete, but a lot are regression testing bugs in data: documents that we still want to test. Those could perhaps be rewritten to put the data: document in a frame.
| Assignee | ||
Comment 2•9 months ago
|
||
Hello,
I'm a new contributor and I've worked on a solution for the first option proposed by Daniel Veditz for this bug, i.e. to "remove the pref from StaticPrefs (and thus about:config) but use the dynamic pref service to check for a non-default value." Are there any tests that I should run before submitting this patch?
Or do we prefer the second option from Daniel Veditz, i.e. completely removing the pref and adjusting all testing accordingly?
| Reporter | ||
Comment 3•9 months ago
|
||
Hello! I definitely prefer the second option of completely removing the pref and adjusting all tests accordingly.
I will warn you though, this is a pretty involved task that will require fixing about two dozen tests across multiple components. If you're up for it, that's great!
https://searchfox.org/firefox-main/search?q=block_toplevel_data_uri_navigations&path=&case=false®exp=false
| Assignee | ||
Comment 4•8 months ago
|
||
Hey Gregory,
I've completed the removal of security.data_uri.block_toplevel_data_uri_navigations as requested and will send the patch through Phabricator next. Just leaving here a quick overview:
Core Implementation:
- Removed pref check from
nsContentSecurityManager.cpp(blocking is now always enabled) - Removed pref definition from
StaticPrefList.yaml - Removed pref from privacy preferences UI (
privacy.js)
Test Updates:
- Deleted 6 obsolete tests that relied on pref toggling
- Created 16 new HTML test files to replace inline data: URIs (which would now be blocked)
- Updated 34 tests to remove pref manipulation calls
- Converted tests from data: URI approach to proper file-based approach through HTTP
| Assignee | ||
Comment 5•8 months ago
|
||
Updated•8 months ago
|
Backed out for causing multiple failures
| Assignee | ||
Comment 9•6 months ago
|
||
Sorry about the breakage. These 6 tests didn't reference the pref directly. They depended on it being set to false globally in testing/profiles/unittest-required/user.js, so I missed them when searching for pref usage. Working on fixes now.
Comment 10•4 months ago
|
||
There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:Joe, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
| Reporter | ||
Updated•4 months ago
|
| Assignee | ||
Comment 11•4 months ago
|
||
Rebased the patch to current main, updated D274022, and did a fresh try push:
https://treeherder.mozilla.org/jobs?repo=try&revision=5340063cb8ac371b75e26230930e218707c5f9cd
I checked the remaining non-green jobs and they appear unrelated to this bug. The revision was Accepted before in Phabricator, but after
the update it is back in “Needs Review”, and I don’t appear to have the permissions/UI needed to land it myself.
Could someone with landing permissions please land D274022?
| Assignee | ||
Comment 12•4 months ago
|
||
Patch is updated with the remaining nit fixes and the revision is accepted. I have try access, but I don’t appear to have Lando/landing permissions. Could someone with landing permissions please land D274022?
Comment 14•4 months ago
|
||
Comment 15•4 months ago
|
||
Comment 16•4 months ago
|
||
Backed out for causing bc failures.
- Backout link
- Push with failures
- Failure Log @browser_911547.js
- Failure Log @browser_bug734076.js
- Failure Log @browser_ext_tabs_executeScript_bad.js
Updated•4 months ago
|
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/59524 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Comment 19•3 months ago
|
||
Hi Joe, after the 3 weeks since the backout of your patch I would like to ask if you want to pick-up the remaining work as needed to get this bug fixed. Please let us know. Thanks!
| Assignee | ||
Comment 20•3 months ago
|
||
Hi Henrik, yes I'll pick it up and try again.
Thanks
Updated•2 months ago
|
Comment 21•2 months ago
|
||
I'm putting the leave-open keyword on this bug; although there is a patch up there, it only partially covers this bug, by fixing up some tests that use the preference. There is quite a bit more work needed before we can declare this bug fixed:
- First, we need to work towards setting the
security.data_uri.block_toplevel_data_uri_navigationspreference to be true by default in unit tests, at https://searchfox.org/firefox-main/rev/e28b34ab33dbf49364999070168cbb7e11e8e5bd/testing/profiles/unittest-required/user.js#208-213 - Once no new test failures are flagged, look for remaining test uses of
security.data_uri.block_toplevel_data_uri_navigations - Once all test uses of
security.data_uri.block_toplevel_data_uri_navigationsare removed, then we can finally drop the preference.
Comment 22•2 months ago
|
||
Comment 23•2 months ago
|
||
Comment 24•2 months ago
|
||
Backed out for causing wd failures
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-PASS | /webdriver/tests/bidi/script/add_preload_script/execution_order_tentative.py | test_preload_script_properties_available_immediately[popup-data_url] - expected FAIL
Comment 25•2 months ago
|
||
Comment 26•2 months ago
|
||
(the patch stuck and has not been reverted; clearing needinfo that was added due to the revert)
Comment 27•2 months ago
|
||
| bugherder | ||
Description
•