Closed Bug 1986632 Opened 5 months ago Closed 4 months ago

Trusted Types policies should not apply to isolated WebExtension content scripts - part 2

Categories

(Core :: DOM: Security, task)

task

Tracking

()

RESOLVED FIXED
145 Branch
Tracking Status
firefox145 --- fixed

People

(Reporter: fredw, Assigned: fredw)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

Attachments

(2 files, 1 obsolete file)

We make some effort to exempt extensions from page CSPs (bug 1267027), we should consider doing the same for Trusted Types, otherwise pages could unduly restrict the functionality of extensions.

This is a follow-up of bug 1947732, it seems some cases where we still pass a null principal to GetTrustedTypesCompliantString:

find dom -type f | xargs grep -A3 GetTrustedTypesCompliantString | grep -B3 nullptr
dom/security/trusted-types/TrustedTypeUtils.cpp-                                             const nsINode& aNode,
--
dom/security/trusted-types/TrustedTypeUtils.cpp:  return GetTrustedTypesCompliantString<TrustedHTML>(
dom/security/trusted-types/TrustedTypeUtils.cpp-      &aInput, aSink, aSinkGroup, aNode, nullptr, aResultHolder, aError);
--
dom/security/trusted-types/TrustedTypeUtils.cpp-    const nsAString& aSinkGroup, nsIGlobalObject& aGlobalObject,
dom/security/trusted-types/TrustedTypeUtils.cpp-    Maybe<nsAutoString>& aResultHolder, ErrorResult& aError) {
dom/security/trusted-types/TrustedTypeUtils.cpp:  return GetTrustedTypesCompliantString<TrustedScript>(
dom/security/trusted-types/TrustedTypeUtils.cpp-      &aInput, aSink, aSinkGroup, aGlobalObject, nullptr, aResultHolder,
--
dom/security/trusted-types/TrustedTypeUtils.cpp-    const nsAString& aSinkGroup, const nsINode& aNode,
dom/security/trusted-types/TrustedTypeUtils.cpp-    Maybe<nsAutoString>& aResultHolder, ErrorResult& aError) {
dom/security/trusted-types/TrustedTypeUtils.cpp:  return GetTrustedTypesCompliantString<TrustedScript>(
dom/security/trusted-types/TrustedTypeUtils.cpp-      &aInput, aSink, aSinkGroup, aNode, nullptr, aResultHolder, aError);
--
--
dom/workers/WorkerScope.cpp:          TrustedTypeUtils::GetTrustedTypesCompliantString(
dom/workers/WorkerScope.cpp-              scriptURL, sink, kTrustedTypesOnlySinkGroup, *pinnedGlobal,
dom/workers/WorkerScope.cpp-              nullptr, compliantStringHolder, aRv);

So they are:

This is a follow-up of bug 1947732, covering the remaining Trusted Types checks:

  • Document.write/writeln
  • WorkerGlobalScope.importScripts
  • eval and new Functions
  • script enforcement
  • pre-navigation check
Assignee: nobody → fwang
Status: NEW → ASSIGNED
Attachment #9511948 - Attachment description: WIP: Bug 1986632 - Add tests for pre-navigation check → WIP: Bug 1986632 - More tests to test_ext_contentscript_trustedtypes.js
Attachment #9511342 - Attachment description: Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers! → WIP: Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers!
Attachment #9511342 - Attachment description: WIP: Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers! → Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers!
Attachment #9511342 - Attachment description: Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers! → WIP: Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers!
Attachment #9511342 - Attachment description: WIP: Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers! → Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers!
Attachment #9511948 - Attachment is obsolete: true
Blocks: 1990732
Attachment #9511342 - Attachment description: Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers! → WIP: Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers!
Attachment #9511342 - Attachment description: WIP: Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers! → Bug 1986632 - Exempt (isolated) WebExtension content scripts from trusted types policies. r?smaug!,#extension-reviewers!
Pushed by fwang@igalia.com: https://github.com/mozilla-firefox/firefox/commit/9a0ef0f5ea5e https://hg.mozilla.org/integration/autoland/rev/80785b6e96ad Exempt (isolated) WebExtension content scripts from trusted types policies. r=smaug,webidl,robwu,dom-worker-reviewers,asuth
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 145 Branch
See Also: → 1613779
QA Whiteboard: [qa-triage-done-c146/b145]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: