-
Notifications
You must be signed in to change notification settings - Fork 79
Disallow empty policy names on creation. #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -954,6 +954,7 @@ To create a {{TrustedTypePolicy}}, given a {{TrustedTypePolicyFactory}} (|factor | |||
a string (|policyName|), {{TrustedTypePolicyOptions}} dictionary (|options|), and a | |||
[=realm/global object=] (|global|) run these steps: | |||
|
|||
1. If |policyName| is the empty string, throw a TypeError and abort further steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please link to the more general spec issue with a note like:
<p class=note> Disallowing the empty string since CSP directives can't refer to that. A limited set of other directives can't be referred to either; those, web-developers will have to rename if they need to be referenced; see https://github.com/w3c/trusted-types/issues/504#issue-2247635542.</p>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending compat analysis on this (not sure if a use counter was ever added), this seems fine to me.
@@ -954,6 +954,7 @@ To create a {{TrustedTypePolicy}}, given a {{TrustedTypePolicyFactory}} (|factor | |||
a string (|policyName|), {{TrustedTypePolicyOptions}} dictionary (|options|), and a | |||
[=realm/global object=] (|global|) run these steps: | |||
|
|||
1. If |policyName| is the empty string, throw a TypeError and abort further steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to say abort further steps? Throwing automatically does that.
Fixes #466.
Preview | Diff