about: page CSP Asserts aren't effective
Categories
(Core :: DOM: Security, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox136 | --- | fixed |
People
(Reporter: tjr, Assigned: tschuster)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [domsecurity-backlog])
Attachments
(1 file)
It was pointed out that the checks against a website running script are not that effective:
// preferences and downloads allow legacy inline scripts through hash src.
MOZ_ASSERT(!foundScriptSrc ||
StringBeginsWith(aboutSpec, "about:preferences"_ns) ||
StringBeginsWith(aboutSpec, "about:settings"_ns) ||
StringBeginsWith(aboutSpec, "about:downloads"_ns) ||
StringBeginsWith(aboutSpec, "about:fingerprinting"_ns) ||
StringBeginsWith(aboutSpec, "about:asrouter"_ns) ||
StringBeginsWith(aboutSpec, "about:newtab"_ns) ||
StringBeginsWith(aboutSpec, "about:logins"_ns) ||
StringBeginsWith(aboutSpec, "about:compat"_ns) ||
StringBeginsWith(aboutSpec, "about:welcome"_ns) ||
StringBeginsWith(aboutSpec, "about:profiling"_ns) ||
StringBeginsWith(aboutSpec, "about:studies"_ns) ||
StringBeginsWith(aboutSpec, "about:home"_ns),
"about: page must not contain a CSP including script-src");
Because a page is required to have default-src; asserting that a page doesn't have script-src (unless it is allowlisted) doesn't really do much, when all the non-allowlisted pages can run script as long as its allowed via default-src.
I think we can just remove this assertion...
Comment 1•1 year ago
|
||
Curious on Freddy's thoughts here and if we can enforce something more meaningful here? E.g. script-src not including unsafe bits nor http/https/data or whatever?
| Reporter | ||
Comment 2•1 year ago
|
||
(In reply to :Gijs (he/him) from comment #1)
script-src not including
unsafebits
nor http/https/data or whatever?
We've got those checks at least :)
Comment 3•1 year ago
|
||
(In reply to Tom Ritter [:tjr] from comment #2)
(In reply to :Gijs (he/him) from comment #1)
script-src not including
unsafebitsnor http/https/data or whatever?
We've got those checks at least :)
Oh, phew. Sorry for not reading more carefully.
Might be useful if we could do the web scheme one for default-src and script-src without any exceptions (which I think should work today?). But yeah, otherwise I guess as comment 0 suggests maybe we just drop the foundScriptSrc one.
| Assignee | ||
Comment 4•1 year ago
|
||
It would also be less error prone to actually use the parsed representation of the CSP policy for finding directives, instead of doing string matching on a serialized string.
Updated•1 year ago
|
Comment 5•1 year ago
•
|
||
+1 to what Tom Schuster said. We should check the parsed CSP rather than string matching.
Something useful to do for our backlog, I could see us exposing a utility function in our CSP code that answers whether a policy satisfies our internal requirements.
| Assignee | ||
Comment 6•1 year ago
|
||
I am going to investigate this, because I want to do something similar for other windows/dialogs.
| Assignee | ||
Comment 7•1 year ago
|
||
Updated•1 year ago
|
Description
•