Skip to content

Deprecate "allow-duplicates" - it's insecure and makes trusted types useless #592

@kkmuffme

Description

@kkmuffme

The "allow-duplicates" completely negates the point of trusted types, since any attacker can just create their own "duplicate" policy with whatever unsafe callbacks.

For example, adding "allow-duplicates" suddenly allows:

const circumvent = trustedTypes.createPolicy(
	'dompurify',
	{
		createHTML( unsafe ) { return unsafe; },
		createScriptURL( unsafe ) { return unsafe; },
	}
);

foo.innerHTML = circumvent.createHTML( 'attacking...' );

At that point you're actually better of not to use trusted types, since at least you're aware that/where security risks are.
"allow-duplicates" just makes trusted-types into a security theater.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions