Remove inline style from MozPanel
Categories
(Toolkit :: UI Widgets, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox136 | --- | fixed |
People
(Reporter: tschuster, Assigned: tschuster)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Every time I open the devtools, I see a bunch of CSP violations in the parent process.
Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:” 2 customElements.js:499:25
Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”
This is apparently caused by the inline style in the MozPanel markup.
I plan on adding telemetry for CSP violations in the parent process, so this would be nice to avoid. Otherwise I am just going to filter these out.
Comment 1•10 months ago
|
||
If it comes from <xul:panel> then it isn't specific to DevTools:
https://searchfox.org/mozilla-central/search?q=createXULElement%28%22panel%22%29&path=&case=false®exp=false
Updated•10 months ago
|
Comment 2•10 months ago
|
||
These other usages of panel doesn't seem to trigger CSP warning, whereas they are also done on chrome: document.
Any idea why they wouldn't be triggered against browser.xhtml?
| Assignee | ||
Comment 3•10 months ago
|
||
Other panel users probably have a less restrictive CSP or no CSP at all. Devtools seems to use default-src chrome: resource:; and no style-src.
Obviously it would best to remove the inline style instead of making the devtools' CSP weaker.
Comment 4•10 months ago
|
||
indeed, the following seems to make the error go away:
diff --git a/devtools/client/framework/toolbox.xhtml b/devtools/client/framework/toolbox.xhtml
--- a/devtools/client/framework/toolbox.xhtml
+++ b/devtools/client/framework/toolbox.xhtml
@@ -7,7 +7,7 @@
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
- csp="default-src chrome: resource:; img-src chrome: resource: data:; object-src 'none'"
+ csp="default-src chrome: resource:; img-src chrome: resource: data:; object-src 'none'; style-src 'unsafe-inline';"
role="application"
>
<linkset>
Comment 5•10 months ago
|
||
Looks like you're using a custom element that has a style= attribute. The more minimal CSP would allow style-src-attr rather than all of style-src.
I think the code is from https://searchfox.org/mozilla-central/rev/ead020d3989d3e9477b353d3d117f9c0f4b16f53/toolkit/content/widgets/panel.js#12, so maybe we should move this to Toolkit :: UI Widgets so that it's fixed at the source and for all consumers?
| Assignee | ||
Updated•10 months ago
|
Comment 6•10 months ago
|
||
The product::component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 7•9 months ago
|
||
I will try to fix this so we don't end up with so many unnecessary telemetry pings.
| Assignee | ||
Comment 8•9 months ago
|
||
Updated•9 months ago
|
Comment 10•9 months ago
|
||
| bugherder | ||
Description
•