Closed Bug 1940273 Opened 1 month ago Closed 6 days ago

Assert that all windows/dialogs have a CSP

Categories

(Core :: DOM: Security, task)

task

Tracking

()

RESOLVED FIXED
137 Branch
Tracking Status
firefox137 --- fixed

People

(Reporter: tschuster, Assigned: tschuster)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [domsecurity-meta])

Attachments

(2 files)

We already assert that about: pages have a CSP (See nsContentSecurityUtils::AssertAboutPageHasCSP) we should do something similar for windows/dialogs.

Severity: -- → N/A
Whiteboard: [domsecurity-meta]
Assignee: nobody → tschuster
Depends on: 1895770

I think I've found all or most chrome documents without a CSP that are loaded during tests now.

Depends on: 1944536
Attachment #9462535 - Attachment description: WIP: Bug 1940273 - Enforce a baseline default-src policy for chrome: pages → Bug 1940273 - Enforce a baseline default-src policy for chrome: pages. r?freddyb
Attachment #9461279 - Attachment description: WIP: Bug 1940273 - Assert that all loaded chrome: documents have some CSP → Bug 1940273 - Assert that all loaded chrome: documents have some CSP. r?freddyb
Keywords: leave-open
Keywords: leave-open
Blocks: 1946040
Pushed by tschuster@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/312c5cc5dc24 Assert that all loaded chrome: documents have some CSP. r=freddyb https://hg.mozilla.org/integration/autoland/rev/f9e293e9ee57 Enforce a baseline default-src policy for chrome: pages. r=freddyb https://hg.mozilla.org/integration/autoland/rev/9a6898e9f3a5 apply code formatting via Lando
Flags: needinfo?(tschuster)
Pushed by tschuster@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1f38e5f88eb8 Assert that all loaded chrome: documents have some CSP. r=freddyb https://hg.mozilla.org/integration/autoland/rev/dbf2787916d6 Enforce a baseline default-src policy for chrome: pages. r=freddyb https://hg.mozilla.org/integration/autoland/rev/76f3a9227fc6 apply code formatting via Lando
Flags: needinfo?(tschuster)
Regressions: 1946862

Could we have some guidance on how to properly port this to Thunderbird?
Our tests in our debug builds are borked https://treeherder.mozilla.org/jobs?repo=comm-central&revision=53ee78223fb053bd26e1b978b74010fe2f6f79aa&selectedTaskRun=OViVBivoQKKdIC77j0iYig.0

Any help or pointing to the right documentation is greatly appreciated.

Flags: needinfo?(tschuster)

Would it be possible to back this out.
This caused mass bustages and multiple test carshes to Thunderbird.

Flags: needinfo?(fbraun)

(In reply to Alessandro Castellani [:aleca] from comment #8)

Could we have some guidance on how to properly port this to Thunderbird?
Our tests in our debug builds are borked https://treeherder.mozilla.org/jobs?repo=comm-central&revision=53ee78223fb053bd26e1b978b74010fe2f6f79aa&selectedTaskRun=OViVBivoQKKdIC77j0iYig.0

  • Should we just add <meta http-equiv="Content-Security-Policy" content="default-src chrome:; object-src 'none'"/> to all our pages?

That would be great, because this is a very secure CSP. Do note that in bug 1946040, I am asserting that all pages that have CSP, have a CSP that is relatively secure. e.g. script-src 'unsafe-inline' is absolutely forbidden.

This is just a temporary measure before we can add a CSP to them. This way, at least, no one introduces new pages without CSPs.

browser.xhtml is a special case, because breaking it could break most of the browser UI. So for the worst case we have a way of disabling it. It's also useful to people modifying Firefox, but the pref is meant to be temporary of course.

See above. We wanted to be able to do a slower rollout of the CSP for browser.xhtml

Any help or pointing to the right documentation is greatly appreciated.

See e.g. this firefox-dev post.

If you don't care about CSPs in Thunderbird you could add "chrome://mail/" to sAllowedChromePagesWithNoCSP.

Flags: needinfo?(tschuster)
No longer regressions: 1946862
See Also: → 1946862
Flags: needinfo?(fbraun)
Regressions: 1947163
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: