Add CSP support for "Create a Trusted Type Policy" for Workers
Categories
(Core :: DOM: Security, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox138 | --- | fixed |
People
(Reporter: fredw, Assigned: fredw)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [domsecurity-backlog], [wptsync upstream])
Attachments
(3 files, 1 obsolete file)
Follow-up of bug 1901492.
See
https://searchfox.org/mozilla-central/rev/86c208f86f35d53dc824f18f8e540fe5b0663870/dom/security/trusted-types/TrustedTypePolicyFactory.cpp#61-70
https://w3c.github.io/trusted-types/dist/spec/#should-block-create-policy
https://github.com/w3c/trusted-types/issues/574
The rough idea will be to somehow expose trusted-types
directives via CSPInfo, so they can be accessed from the worker thread.
In bug 1901492, this was done for require-trusted-types-for
but the data was much simpler (essentially a three states enum).
Assignee | ||
Updated•7 months ago
|
Assignee | ||
Comment 1•5 months ago
|
||
This patch rewrites ShouldTrustedTypePolicyCreationBeBlockedByCSP so
that CSP violation reports are performed in a static function
ReportPolicyCreationViolations, separate from the calculation of the
PolicyCreation result.
For requests of policy creation originating from a worker, this allows
to implement a LogPolicyCreationViolationsRunnable in order to report
violations. In follow-up patches, we will implement the calculation of
the PolicyCreation result from the CSPInfo.
Updated•5 months ago
|
Assignee | ||
Comment 2•5 months ago
|
||
This is done by exposing on CSPInfo the raw array of tt-expressions
associated to a CSPInfo::ContentSecurityPolicy [1]. Then we use a static
version of nsCSPDirective::ShouldCreateViolationForNewTrustedTypesPolicy
that relies on this raw array instead of an actual nsCSPDirective.
[1] https://w3c.github.io/trusted-types/dist/spec/#tt-expression
Assignee | ||
Comment 3•5 months ago
|
||
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Assignee | ||
Comment 4•5 months ago
|
||
Comment 7•5 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/951a7cba63f5
https://hg.mozilla.org/mozilla-central/rev/24a402ea04d1
https://hg.mozilla.org/mozilla-central/rev/0a18e08c5a3f
Comment 9•5 months ago
|
||
Apparently this breaks profiles after upgrading Firefox: bug 1958259. (My fault not noticing this!) I think we should just backout https://hg.mozilla.org/integration/autoland/rev/0a18e08c5a3f in Nightly and Beta. I think I have a potential solution that doesn't require changing the serialization format that I am going to investigate afterwards.
Comment 10•5 months ago
|
||
Comment 11•5 months ago
|
||
Since the backout is only part of what landed here, could it be done in a separate bug. Otherwise tracking what is where gets a bit tricky.
Comment 12•5 months ago
|
||
Comment on attachment 9476931 [details]
Bug 1942306 - Backout 0a18e08c5a3fc4f99f71c3621c111a7e9be01a40 for causing profile upgrade errors. r?smaug
Revision D244336 was moved to bug 1958259. Setting attachment 9476931 [details] to obsolete.
Updated•5 months ago
|
Updated•5 months ago
|
Description
•