Skip to content

Conversation

@lukewarlow
Copy link
Member

@lukewarlow lukewarlow commented Jan 29, 2024

caf4cd7

Implement enforcement of `require-trusted-types-for` CSP directive
https://bugs.webkit.org/show_bug.cgi?id=267685

Reviewed by Darin Adler.

This patch implements the StringContext idl attribute to check
the `require-trusted-types-for` CSP and enforce trusted types accordingly.

This patch also makes use of the StringContext IDL attribute on an initial set of sinks.

More complicated sinks such as setAttribute, execCommand, eval and timer functions will be addressed in follow ups.

Spec: https://w3c.github.io/trusted-types/dist/spec/#integrations

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/content-security-policy/reporting/report-clips-sample.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/HTMLElement-generic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/HTMLScriptElement-internal-slot-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/WorkerGlobalScope-importScripts-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-DOMParser-parseFromString-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Document-write-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-insertAdjacentHTML-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-outerHTML-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-HTMLElement-generic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Range-createContextualFragment-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-text-node-insertion-into-script-element-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/default-policy-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/default-policy-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/empty-default-policy-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/empty-default-policy-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/no-require-trusted-types-for-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/require-trusted-types-for-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/require-trusted-types-for-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-createHTMLDocument-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-reporting-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-source-file-path-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-svg-script-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/worker-constructor.https-expected.txt:
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/IDLTypes.h:
* Source/WebCore/bindings/js/JSDOMConvertStrings.cpp:
(WebCore::trustedTypeCompliantString):
* Source/WebCore/bindings/js/JSDOMConvertStrings.h:
(WebCore::Converter<IDLStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::Converter<IDLLegacyNullToEmptyStringStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLLegacyNullToEmptyStringStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::Converter<IDLStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::JSConverter<IDLStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::Converter<IDLLegacyNullToEmptyStringStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::JSConverter<IDLLegacyNullToEmptyStringStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::Converter<IDLStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::Converter<IDLLegacyNullToEmptyStringStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLLegacyNullToEmptyStringStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::Converter<IDLAtomStringStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLAtomStringStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::Converter<IDLAtomStringStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::JSConverter<IDLAtomStringStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::Converter<IDLAtomStringStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLAtomStringStringContextTrustedScriptURLAdaptor<T>>::convert):
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
(IsAnnotatedType):
(GetAnnotatedIDLType):
(JSValueToNative):
* Source/WebCore/bindings/scripts/IDLAttributes.json:
* Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl:
* Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObject_TestStringContextConstructorGetter):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
* Source/WebCore/bindings/scripts/test/JS/JSTestStringContext.cpp: Added.
(WebCore::JSTestStringContextDOMConstructor::prototypeForStructure):
(WebCore::JSTestStringContextDOMConstructor::initializeProperties):
(WebCore::JSTestStringContextPrototype::finishCreation):
(WebCore::JSTestStringContext::JSTestStringContext):
(WebCore::JSTestStringContext::createPrototype):
(WebCore::JSTestStringContext::prototype):
(WebCore::JSTestStringContext::getConstructor):
(WebCore::JSTestStringContext::destroy):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedHTMLGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedHTMLSetter):
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedScriptGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedScriptSetter):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedScriptURLGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedScriptURLSetter):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedHTMLAndLegacyNullToEmptyStringGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedHTMLAndLegacyNullToEmptyStringSetter):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedScriptAndLegacyNullToEmptyStringGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedScriptAndLegacyNullToEmptyStringSetter):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedScriptURLAndLegacyNullToEmptyStringGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedScriptURLAndLegacyNullToEmptyStringSetter):
(WebCore::jsTestStringContext_reflectedAttributeWithStringContextTrustedHTMLGetter):
(WebCore::setJSTestStringContext_reflectedAttributeWithStringContextTrustedHTMLSetter):
(WebCore::jsTestStringContext_reflectedAttributeWithStringContextTrustedScriptGetter):
(WebCore::setJSTestStringContext_reflectedAttributeWithStringContextTrustedScriptSetter):
(WebCore::jsTestStringContext_reflectedAttributeWithStringContextTrustedScriptURLGetter):
(WebCore::setJSTestStringContext_reflectedAttributeWithStringContextTrustedScriptURLSetter):
(WebCore::jsTestStringContext_reflectedUrlAttributeWithStringContextTrustedHTMLGetter):
(WebCore::setJSTestStringContext_reflectedUrlAttributeWithStringContextTrustedHTMLSetter):
(WebCore::jsTestStringContext_reflectedUrlAttributeWithStringContextTrustedScriptGetter):
(WebCore::setJSTestStringContext_reflectedUrlAttributeWithStringContextTrustedScriptSetter):
(WebCore::jsTestStringContext_reflectedUrlAttributeWithStringContextTrustedScriptURLGetter):
(WebCore::setJSTestStringContext_reflectedUrlAttributeWithStringContextTrustedScriptURLSetter):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedHTMLBody):
(WebCore::JSC_DEFINE_HOST_FUNCTION):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedScriptBody):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedScriptURLBody):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedHTMLAndLegacyNullToEmptyStringBody):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedScriptAndLegacyNullToEmptyStringBody):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedScriptURLAndLegacyNullToEmptyStringBody):
(WebCore::JSTestStringContext::subspaceForImpl):
(WebCore::JSTestStringContext::analyzeHeap):
(WebCore::JSTestStringContextOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestStringContextOwner::finalize):
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
(WebCore::JSTestStringContext::toWrapped):
* Source/WebCore/bindings/scripts/test/JS/JSTestStringContext.h: Added.
(WebCore::JSTestStringContext::create):
(WebCore::JSTestStringContext::createStructure):
(WebCore::JSTestStringContext::subspaceFor):
(WebCore::wrapperOwner):
(WebCore::wrapperKey):
(WebCore::toJS):
(WebCore::toJSNewlyCreated):
* Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep:
* Source/WebCore/bindings/scripts/test/TestStringContext.idl: Added.
* Source/WebCore/dom/Document+HTML.idl:
* Source/WebCore/dom/Document.idl:
* Source/WebCore/dom/Element+DOMParsing.idl:
* Source/WebCore/dom/InnerHTML.idl:
* Source/WebCore/dom/Range+DOMParsing.idl:
* Source/WebCore/dom/TrustedType.cpp: Added.
(WebCore::TrustedTypeVisitor::operator()):
(WebCore::trustedTypeToString):
(WebCore::trustedTypeToCallbackName):
(WebCore::processValueWithDefaultPolicy):
(WebCore::trustedTypeCompliantString):
* Source/WebCore/dom/TrustedType.h: Copied from Source/WebCore/workers/Worker.idl.
* Source/WebCore/dom/TrustedTypePolicy.cpp:
(WebCore::TrustedTypePolicy::createHTML):
(WebCore::TrustedTypePolicy::createScript):
(WebCore::TrustedTypePolicy::createScriptURL):
(WebCore::TrustedTypePolicy::getPolicyValue):
* Source/WebCore/dom/TrustedTypePolicy.h:
* Source/WebCore/html/HTMLEmbedElement.idl:
* Source/WebCore/html/HTMLIFrameElement.idl:
* Source/WebCore/html/HTMLObjectElement.idl:
* Source/WebCore/html/HTMLScriptElement.idl:
* Source/WebCore/page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::requireTrustedTypesForSinkGroup const):
(WebCore::ContentSecurityPolicy::allowMissingTrustedTypesForSinkGroup const):
(WebCore::ContentSecurityPolicy::reportViolation const):
* Source/WebCore/page/csp/ContentSecurityPolicy.h:
* Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::shouldReportSample const):
* Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h:
(WebCore::ContentSecurityPolicyDirectiveList::requiresTrustedTypesForScript const):
* Source/WebCore/workers/Worker.idl:
* Source/WebCore/workers/WorkerGlobalScope.idl:
* Source/WebCore/workers/service/ServiceWorkerContainer.idl:
* Source/WebCore/workers/shared/SharedWorker.idl:
* Source/WebCore/xml/DOMParser.idl:

Canonical link: https://commits.webkit.org/275607@main

6f76254

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 tv-sim
✅ 🛠 🧪 merge ✅ 🛠 watch
✅ 🛠 watch-sim

@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from 0ddfb1a to a87a721 Compare January 29, 2024 12:39
@lukewarlow lukewarlow self-assigned this Jan 29, 2024
@lukewarlow lukewarlow added the WebCore Misc. For miscellaneous bugs in the WebCore framework (and not JavaScriptCore or WebKit). label Jan 29, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jan 29, 2024
@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from a87a721 to 3291302 Compare January 29, 2024 14:39
@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from 3291302 to ad81fce Compare January 29, 2024 14:47
@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from ad81fce to 4fa428e Compare January 29, 2024 15:21
@lukewarlow lukewarlow removed the merging-blocked Applied to prevent a change from being merged label Feb 1, 2024
@lukewarlow lukewarlow changed the title Implement enforcement of require-trusted-types-for CSP directive Implement Feb 1, 2024
@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from 4fa428e to f953c9b Compare February 1, 2024 14:10
@lukewarlow lukewarlow changed the title Implement Implement enforcement of require-trusted-types-for CSP directive Feb 1, 2024
@lukewarlow lukewarlow changed the title Implement enforcement of require-trusted-types-for CSP directive Implement Feb 1, 2024
@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from f953c9b to b797455 Compare February 1, 2024 14:15
@lukewarlow lukewarlow changed the title Implement Implement enforcement of require-trusted-types-for CSP directive Feb 1, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 1, 2024
@lukewarlow lukewarlow requested a review from youennf February 27, 2024 22:53
@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from 4117d54 to 9a795ba Compare February 27, 2024 23:14
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 28, 2024
@lukewarlow lukewarlow removed the merging-blocked Applied to prevent a change from being merged label Feb 28, 2024
Copy link
Member

@darinadler darinadler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a first pass and found some things to improve.

webkit.org/b/261849 imported/w3c/web-platform-tests/css/css-scroll-anchoring/start-edge-in-block-layout-direction.html [ Skip ]

# Trusted Types aren't implemented yet
# Trusted Types aren't fully implemented yet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it best to skip these tests instead of expecting failures? Normally we would only want to skip a test if it hangs or runs very slowly. It’s much better to just expect a failure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all of these are timeouts because they timeout in the failure case.

ExceptionOr<Ref<TrustedHTML>> createHTML(const String& input, FixedVector<JSC::Strong<JSC::Unknown>>&&);
ExceptionOr<Ref<TrustedScript>> createScript(const String& input, FixedVector<JSC::Strong<JSC::Unknown>>&&);
ExceptionOr<Ref<TrustedScriptURL>> createScriptURL(const String& input, FixedVector<JSC::Strong<JSC::Unknown>>&&);
ExceptionOr<String> getPolicyValue(const TrustedType trustedTypeName, const String& input, FixedVector<JSC::Strong<JSC::Unknown>>&&, bool throwIfMissing = true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just be TrustedType not const TrustedType.

We try to avoid mystery bool arguments like this throwIfMissing one. Can we find a way to not have that, perhaps by having more than one function? I think one function can return null string if missing and the one that throws if missing can just call the other and post process it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with returning nullString and post processing is that the callbacks themselves can return null and they shouldn't throw in this situation.

I'll make it a boolean enum instead so it's more explicit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can split this into two separate functions. Whether internally you want to use a bool argument to a common function or can find a way to have one call the other is something we can tinker with. I am almost certain you can have one call the other but I can propose a specific way once I see your revised patch. For example if you can distinguish the specific exception you can convert the exception to a null string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing something like in a GetPolicyValueForProcessDefault function could work? But it doesn't feel great, unfortunately the ExceptionCode alone isn't enough to distinguish because TypeErrors are thrown in other cases (such as from userland code)

    auto policyValue = getPolicyValue(trustedTypeName, input, WTFMove(arguments));
    if (policyValue.hasException()) {
        if (policyValue.exception().message().contains("TrustedTypePolicyOptions did not specify"_s))
            return String(nullString());
    }

    return policyValue;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes clearly wrong if it needs to check the string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it to an enum so it's at least not a magic bool.

@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from 9a795ba to 192efe1 Compare March 1, 2024 01:32
@lukewarlow lukewarlow requested a review from darinadler March 1, 2024 01:32
@lukewarlow
Copy link
Member Author

@darinadler Thanks for the review I've addressed or replied to all your comments

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 1, 2024
@lukewarlow lukewarlow removed the merging-blocked Applied to prevent a change from being merged label Mar 1, 2024
@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from 192efe1 to 49d817e Compare March 1, 2024 02:46
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 1, 2024
@lukewarlow lukewarlow removed the merging-blocked Applied to prevent a change from being merged label Mar 1, 2024
@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from 49d817e to 8b6337d Compare March 1, 2024 17:19
@lukewarlow lukewarlow force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from 8b6337d to 6f76254 Compare March 3, 2024 16:05
@lukewarlow lukewarlow added the safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks label Mar 3, 2024
@webkit-ews-buildbot webkit-ews-buildbot added merge-queue Applied to send a pull request to merge-queue and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Mar 3, 2024
@webkit-ews-buildbot
Copy link
Collaborator

Safe-Merge-Queue: Build #13879.

https://bugs.webkit.org/show_bug.cgi?id=267685

Reviewed by Darin Adler.

This patch implements the StringContext idl attribute to check
the `require-trusted-types-for` CSP and enforce trusted types accordingly.

This patch also makes use of the StringContext IDL attribute on an initial set of sinks.

More complicated sinks such as setAttribute, execCommand, eval and timer functions will be addressed in follow ups.

Spec: https://w3c.github.io/trusted-types/dist/spec/#integrations

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/content-security-policy/reporting/report-clips-sample.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/HTMLElement-generic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/HTMLScriptElement-internal-slot-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/WorkerGlobalScope-importScripts-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-DOMParser-parseFromString-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Document-write-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-insertAdjacentHTML-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-outerHTML-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-HTMLElement-generic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Range-createContextualFragment-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-text-node-insertion-into-script-element-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/default-policy-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/default-policy-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/empty-default-policy-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/empty-default-policy-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/no-require-trusted-types-for-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/require-trusted-types-for-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/require-trusted-types-for-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-createHTMLDocument-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-report-only-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-reporting-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-source-file-path-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-svg-script-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/trusted-types/worker-constructor.https-expected.txt:
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/IDLTypes.h:
* Source/WebCore/bindings/js/JSDOMConvertStrings.cpp:
(WebCore::trustedTypeCompliantString):
* Source/WebCore/bindings/js/JSDOMConvertStrings.h:
(WebCore::Converter<IDLStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::Converter<IDLLegacyNullToEmptyStringStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLLegacyNullToEmptyStringStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::Converter<IDLStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::JSConverter<IDLStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::Converter<IDLLegacyNullToEmptyStringStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::JSConverter<IDLLegacyNullToEmptyStringStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::Converter<IDLStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::Converter<IDLLegacyNullToEmptyStringStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLLegacyNullToEmptyStringStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::Converter<IDLAtomStringStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLAtomStringStringContextTrustedHTMLAdaptor<T>>::convert):
(WebCore::Converter<IDLAtomStringStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::JSConverter<IDLAtomStringStringContextTrustedScriptAdaptor<T>>::convert):
(WebCore::Converter<IDLAtomStringStringContextTrustedScriptURLAdaptor<T>>::convert):
(WebCore::JSConverter<IDLAtomStringStringContextTrustedScriptURLAdaptor<T>>::convert):
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
(IsAnnotatedType):
(GetAnnotatedIDLType):
(JSValueToNative):
* Source/WebCore/bindings/scripts/IDLAttributes.json:
* Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl:
* Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObject_TestStringContextConstructorGetter):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
* Source/WebCore/bindings/scripts/test/JS/JSTestStringContext.cpp: Added.
(WebCore::JSTestStringContextDOMConstructor::prototypeForStructure):
(WebCore::JSTestStringContextDOMConstructor::initializeProperties):
(WebCore::JSTestStringContextPrototype::finishCreation):
(WebCore::JSTestStringContext::JSTestStringContext):
(WebCore::JSTestStringContext::createPrototype):
(WebCore::JSTestStringContext::prototype):
(WebCore::JSTestStringContext::getConstructor):
(WebCore::JSTestStringContext::destroy):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedHTMLGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedHTMLSetter):
(WebCore::JSC_DEFINE_CUSTOM_SETTER):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedScriptGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedScriptSetter):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedScriptURLGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedScriptURLSetter):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedHTMLAndLegacyNullToEmptyStringGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedHTMLAndLegacyNullToEmptyStringSetter):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedScriptAndLegacyNullToEmptyStringGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedScriptAndLegacyNullToEmptyStringSetter):
(WebCore::jsTestStringContext_attributeWithStringContextTrustedScriptURLAndLegacyNullToEmptyStringGetter):
(WebCore::setJSTestStringContext_attributeWithStringContextTrustedScriptURLAndLegacyNullToEmptyStringSetter):
(WebCore::jsTestStringContext_reflectedAttributeWithStringContextTrustedHTMLGetter):
(WebCore::setJSTestStringContext_reflectedAttributeWithStringContextTrustedHTMLSetter):
(WebCore::jsTestStringContext_reflectedAttributeWithStringContextTrustedScriptGetter):
(WebCore::setJSTestStringContext_reflectedAttributeWithStringContextTrustedScriptSetter):
(WebCore::jsTestStringContext_reflectedAttributeWithStringContextTrustedScriptURLGetter):
(WebCore::setJSTestStringContext_reflectedAttributeWithStringContextTrustedScriptURLSetter):
(WebCore::jsTestStringContext_reflectedUrlAttributeWithStringContextTrustedHTMLGetter):
(WebCore::setJSTestStringContext_reflectedUrlAttributeWithStringContextTrustedHTMLSetter):
(WebCore::jsTestStringContext_reflectedUrlAttributeWithStringContextTrustedScriptGetter):
(WebCore::setJSTestStringContext_reflectedUrlAttributeWithStringContextTrustedScriptSetter):
(WebCore::jsTestStringContext_reflectedUrlAttributeWithStringContextTrustedScriptURLGetter):
(WebCore::setJSTestStringContext_reflectedUrlAttributeWithStringContextTrustedScriptURLSetter):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedHTMLBody):
(WebCore::JSC_DEFINE_HOST_FUNCTION):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedScriptBody):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedScriptURLBody):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedHTMLAndLegacyNullToEmptyStringBody):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedScriptAndLegacyNullToEmptyStringBody):
(WebCore::jsTestStringContextPrototypeFunction_methodWithStringContextTrustedScriptURLAndLegacyNullToEmptyStringBody):
(WebCore::JSTestStringContext::subspaceForImpl):
(WebCore::JSTestStringContext::analyzeHeap):
(WebCore::JSTestStringContextOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestStringContextOwner::finalize):
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
(WebCore::JSTestStringContext::toWrapped):
* Source/WebCore/bindings/scripts/test/JS/JSTestStringContext.h: Added.
(WebCore::JSTestStringContext::create):
(WebCore::JSTestStringContext::createStructure):
(WebCore::JSTestStringContext::subspaceFor):
(WebCore::wrapperOwner):
(WebCore::wrapperKey):
(WebCore::toJS):
(WebCore::toJSNewlyCreated):
* Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep:
* Source/WebCore/bindings/scripts/test/TestStringContext.idl: Added.
* Source/WebCore/dom/Document+HTML.idl:
* Source/WebCore/dom/Document.idl:
* Source/WebCore/dom/Element+DOMParsing.idl:
* Source/WebCore/dom/InnerHTML.idl:
* Source/WebCore/dom/Range+DOMParsing.idl:
* Source/WebCore/dom/TrustedType.cpp: Added.
(WebCore::TrustedTypeVisitor::operator()):
(WebCore::trustedTypeToString):
(WebCore::trustedTypeToCallbackName):
(WebCore::processValueWithDefaultPolicy):
(WebCore::trustedTypeCompliantString):
* Source/WebCore/dom/TrustedType.h: Copied from Source/WebCore/workers/Worker.idl.
* Source/WebCore/dom/TrustedTypePolicy.cpp:
(WebCore::TrustedTypePolicy::createHTML):
(WebCore::TrustedTypePolicy::createScript):
(WebCore::TrustedTypePolicy::createScriptURL):
(WebCore::TrustedTypePolicy::getPolicyValue):
* Source/WebCore/dom/TrustedTypePolicy.h:
* Source/WebCore/html/HTMLEmbedElement.idl:
* Source/WebCore/html/HTMLIFrameElement.idl:
* Source/WebCore/html/HTMLObjectElement.idl:
* Source/WebCore/html/HTMLScriptElement.idl:
* Source/WebCore/page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::requireTrustedTypesForSinkGroup const):
(WebCore::ContentSecurityPolicy::allowMissingTrustedTypesForSinkGroup const):
(WebCore::ContentSecurityPolicy::reportViolation const):
* Source/WebCore/page/csp/ContentSecurityPolicy.h:
* Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::shouldReportSample const):
* Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h:
(WebCore::ContentSecurityPolicyDirectiveList::requiresTrustedTypesForScript const):
* Source/WebCore/workers/Worker.idl:
* Source/WebCore/workers/WorkerGlobalScope.idl:
* Source/WebCore/workers/service/ServiceWorkerContainer.idl:
* Source/WebCore/workers/shared/SharedWorker.idl:
* Source/WebCore/xml/DOMParser.idl:

Canonical link: https://commits.webkit.org/275607@main
@webkit-commit-queue webkit-commit-queue force-pushed the trusted-types-require-trusted-types-for-csp-violation branch from 6f76254 to caf4cd7 Compare March 3, 2024 19:24
@webkit-commit-queue
Copy link
Collaborator

Committed 275607@main (caf4cd7): https://commits.webkit.org/275607@main

Reviewed commits have been landed. Closing PR #23412 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit caf4cd7 into WebKit:main Mar 3, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebCore Misc. For miscellaneous bugs in the WebCore framework (and not JavaScriptCore or WebKit).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants