-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Improve Trusted Types test coverage over eval and Function constructor #49461
Conversation
c202501
to
b37b2fd
Compare
content-security-policy/reporting/report-clips-sample.https.html
Outdated
Show resolved
Hide resolved
content-security-policy/reporting/report-clips-sample.https.html
Outdated
Show resolved
Hide resolved
- Add tests for multi-argument function constructor calls - Add tests for exotic Function types (e.g. generators) - Add more tests for the CSP sample prefix-stripping behaviour - Fixed default policy sample test for Function constructor to match spec. (Chromium is non-spec compliant currently).
b37b2fd
to
44fd27b
Compare
}, `Unsafe indirect eval violation sample is clipped to ${trimmedSampleLength} characters.`); | ||
|
||
const functionBody = "return '1234567890123456789012345678901234567890';"; | ||
const sampleWithoutFunctionPrefix = `(a,b\n) {\nreturn ${functionBody}\n}`; |
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.
@lukewarlow I hadn't checked the change again after approving, but sampleWithoutFunctionPrefix should not have the return
statement, since it's already in functionBody.
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.
Apologies I should have spotted that! (None of the browsers currently pass this test so didn't actually run it to double check).
Add tests for multi-argument function constructor calls
Add tests for exotic Function types (e.g. generators)
Add more tests for the CSP sample prefix-stripping behaviour
Fixed default policy sample test for Function constructor to match spec. (Chromium is non-spec compliant currently).