Skip to content

Required resources blocked by Trusted-Types CSP #1334

@Black-Platypus

Description

@Black-Platypus

(Please fill out the issue template with your details)

Expected Behavior

TM manages to inject required resources

Actual Behavior

On websites using a strict Content-Security-Policy: require-trusted-types-for 'script'; / trusted-types, injection fails with the unhandled errors:

This document requires 'TrustedScript' assignment.
This document requires 'TrustedHTML' assignment.

(Full log attached)

Test the behavior here: https://benjamin-philipp.com/test-trusted-types.php?defaultPolicy=true

Specifications

  • Chromium: 93.0.4577.82 (Official Build) (64-bit)
  • TM: 4.13
  • OS: Windows 10

Script

(Please give an example of the script if applicable.)

// ==UserScript==
// @name		tmp
// @version		1.0.0
// @namespace	bp
// @match		https://benjamin-philipp.com/test-trusted-types.php*
// @require 	http://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js
// @require 	https://benjamin-philipp.com/js/gm/funcs.js?a=b
// @run-at		document-body
// @noframes
// @grant		none
// ==/UserScript==

console.log("With strict TrustedTypes implementation, this UserScript will fail while attempting to load the @requite scripts");
// $("#myElement").html("<p>toast</p>");

benjamin-philipp.com-1632523189216.log

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions