WebExtensions fail security check when attempting to use browser resource SVG as a mask-image
Categories
(WebExtensions :: General, defect, P3)
Tracking
(firefox-esr60 unaffected, firefox-esr68 verified, firefox64 wontfix, firefox65 wontfix, firefox68 wontfix, firefox69 verified, firefox70 verified)
People
(Reporter: freaktechnik, Assigned: emilio)
References
(Blocks 1 open bug)
Details
(Keywords: regression)
Attachments
(3 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
RyanVM
:
approval-mozilla-esr68+
|
Details | Review |
1.12 KB,
patch
|
Details | Diff | Splinter Review |
Comment 1•6 years ago
|
||
Comment 2•6 years ago
|
||
Reporter | ||
Comment 3•6 years ago
|
||
Updated•6 years ago
|
Comment 4•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Reporter | ||
Comment 5•6 years ago
|
||
Comment 6•6 years ago
|
||
Comment 7•6 years ago
|
||
Reporter | ||
Comment 8•6 years ago
|
||
Updated•6 years ago
|
Comment 9•6 years ago
|
||
Comment 10•6 years ago
|
||
Updated•6 years ago
|
Comment 11•6 years ago
|
||
Comment 12•6 years ago
|
||
Comment 13•6 years ago
|
||
Assignee | ||
Comment 14•6 years ago
|
||
Comment 15•6 years ago
|
||
Comment 16•6 years ago
|
||
Hi, is there anything new about this problem, or a way to work around it, other than embed the colored icons in png format?
As an addon developer (cookie-quick-manager), this has been a problem for some versions of Firefox since it makes it difficult to manage containers, and raises alarming and unjustified security errors.
Comment 17•5 years ago
|
||
I regret that Bugzilla doesn't automatically raise bugs' priority after some time (say 6 months?) or that Mozilla doesn't plan pauses in Firefox development (say once a year?) so the backlog gets deserved attention from time to time (including lower priority bugs) and everyone's involvement to reduce it. Without a similar organization, the sad fact is some bugs never get fixed... (this particular one is probably not the best example - "only" 10 months old, there are much more severe examples in terms of oldness, always treated as low priority and never solved)
Just my thoughts and humble proposals. But maybe reality is much more complex...
Assignee | ||
Comment 18•5 years ago
|
||
Just took another look at this, fwiw. I don't think the SEC_ALLOW_CHROME thing works, since it's loaded from content.
Also it seems we already pass that flag for images anyway: https://searchfox.org/mozilla-central/rev/0ffa9e372df56c95547fed9c3433ddec4fbf6f11/image/imgLoader.cpp#820
Though it seems like we should be hitting this:
And the images are marked as content-accessible: https://searchfox.org/mozilla-central/rev/0ffa9e372df56c95547fed9c3433ddec4fbf6f11/browser/components/contextualidentity/jar.mn#8
So I'm unsure that the diagnostic in comment 7 is 100% correct... Since if my reading of the code is correct the check should be passing.
Sorry this fell down to the cracks. I'll take a closer look to see what's really going on here...
Assignee | ||
Comment 19•5 years ago
|
||
Sorry, that ni? was supposed to go for me so I don't forget :)
Assignee | ||
Comment 20•5 years ago
|
||
This fixes at least part of the problem. Without this patch, some of the flags
may get lost, like the ALLOW_CHROME flag which controls whether stuff like
resource:// URLs can be loaded or not.
Assignee | ||
Comment 21•5 years ago
|
||
So with the patch above we get further, but still not quite.
With that patch we end up erroring a bit later here
Christoph, would it be a good approach for this to do something like adding another flag to LoadInfo
to bypass CORS if not http?
Or would you prefer something more explicit like what we do to allow fonts from file://
URIs?
Comment 22•5 years ago
|
||
We already have a flag 'bypassCors'. Probably you could move the check before the |if (!http) { ...}|-check which should hopefully fix your problem, see:
https://searchfox.org/mozilla-central/source/netwerk/protocol/http/nsCORSListenerProxy.cpp#561
Assignee | ||
Comment 23•5 years ago
|
||
It doesn't, because I don't want to bypass CORS unconditionally. I want to do it if it's not an http channel.
Assignee | ||
Comment 24•5 years ago
|
||
CORS only works on http channels, so anything else that tries to do a
CORS-enabled request fails catastrophically.
resource:// images are useful for extension developers, so don't perform CORS
checks on them. We may want to also do file:// and fix bug 1565509, while at it,
if we consider it's causing developer pain.
Assignee | ||
Comment 25•5 years ago
|
||
I wrote another patch on the lines of the second approach in comment 21 + a test... But it is somewhat weird that CORS on non-HTTP channels just bails completely.
Assignee | ||
Comment 26•5 years ago
|
||
Per discussion the first patch is worth landing on isolation, regardless of whether we go with the approach in comment 24 or a more generic approach (see the phabricator discussion for more details).
Comment 27•5 years ago
|
||
Comment 28•5 years ago
|
||
bugherder |
Comment 29•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 30•5 years ago
|
||
Comment 31•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ebfc26247087
https://hg.mozilla.org/mozilla-central/rev/e7c19d82c5a5
Comment 32•5 years ago
|
||
This looks kinda scary to backport - what are your thoughts, Emilio?
Assignee | ||
Comment 33•5 years ago
|
||
I don't think it's scary to backport D40651 if we wanted to. The other patch I agree is slightly more scary, but is not needed to fix the bug.
Assignee | ||
Comment 34•5 years ago
|
||
Comment on attachment 9083038 [details]
Bug 1499000 - Don't do CORS checks on CSS images with the resource:// scheme.
Beta/Release Uplift Approval Request
- User impact if declined: comment 0
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Just an "if scheme is resource://, then don't do CORS" which returns to our previous behavior with these images.
- String changes made/needed: none
Comment 35•5 years ago
|
||
Comment on attachment 9083038 [details]
Bug 1499000 - Don't do CORS checks on CSS images with the resource:// scheme.
Fixes CORS issues with some extensions by reverting us to prior behavior. Approved for 69.0b14 and 68.1esr.
Comment 36•5 years ago
|
||
bugherder uplift |
Comment 37•5 years ago
|
||
I tried to uplift to esr68 but got conflicts:
grafting 559526:ebfc26247087 "Bug 1499000 - Don't do CORS checks on CSS images with the resource:// scheme. r=bzbarsky"
merging layout/reftests/svg/reftest.list
merging layout/style/ImageLoader.cpp
merging layout/style/ServoStyleConstsInlines.h
merging servo/ports/geckolib/cbindgen.toml
warning: conflicts while merging layout/reftests/svg/reftest.list! (edit, then use 'hg resolve --mark')
warning: conflicts while merging layout/style/ImageLoader.cpp! (edit, then use 'hg resolve --mark')
warning: conflicts while merging layout/style/ServoStyleConstsInlines.h! (edit, then use 'hg resolve --mark')
warning: conflicts while merging servo/ports/geckolib/cbindgen.toml! (edit, then use 'hg resolve --mark')
Comment 38•5 years ago
|
||
bugherder uplift |
Assignee | ||
Comment 40•5 years ago
|
||
Comment 41•5 years ago
|
||
bugherder uplift |
Comment 42•5 years ago
|
||
Hello,
If this requires no manual testing, as seen in the Beta/Release Uplift Approval Request comment, could the "qe-" flag be added?
If manual testing is in fact required please set the "qe+" flag and provide some steps to reproduce this issue.
Thank you
Assignee | ||
Comment 43•5 years ago
|
||
STR:
- Load https://crisal.io/tmp/mask-image-resource.html
- Ensure the following renders: One big black fingerprint on red background, then two squares with small red fingerprints on white backgrounds, then one with small black fingerprints on red background.
Comment 44•5 years ago
|
||
Verified fix successfully on Windows 10 64-bit and Ubuntu 18.04.0 LTS on Fx 70.0a1 (20190821215524) and 69.0b15 (20190819184224).
For Firefox ESR, I could not check, as the build from comment 41 could not be retrieved.
Assignee | ||
Comment 45•5 years ago
|
||
Any later build from here for example should do, right? https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr68&revision=d574e9e14ca210c752f005fb2b55af3f79a03c9d
Comment 46•5 years ago
|
||
It worked, thank you. I've managed to install and test on Windows 10 -64 bit with Fx 68.1.0esr (20190821232631) and all the squares are rendered along with the fingerprints and the colors. I'm setting this as Verified.
Updated•5 years ago
|
Description
•