Skip to content
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

clarify whether csp blocks reflection of non-string arguments to eval #201

Open
jeisinger opened this issue Apr 7, 2017 · 3 comments
Open
Assignees

Comments

@jeisinger
Copy link
Member

e.g. should eval(1) return 1 or throw an exception?

@mikewest
Copy link
Member

mikewest commented Apr 7, 2017

I think the spec defers to ECMAScript's call to HostEnsureCanCompileStrings in https://tc39.github.io/ecma262/#sec-function-calls-runtime-semantics-evaluation, which (I think) punts if the argument isn't a string? Maybe? So, I think we're technically correct alrerady, which is best correct.

We should probably add a note to the list of APIs governed by 'unsafe-eval' to carve out only string-based eval.

@domenic
Copy link
Contributor

domenic commented Apr 17, 2017

There's no punting. HostEnsureCanCompileStrings doesn't get to inspect its argument. So it should block it regardless.

This would be a great web platform test for someone to write. If we find all browsers don't have CSP block eval of non-strings, then we should consider updating the spec infrastructure, probably by updating ES to not call HostEnsureCanCompileStrings in such cases.

@mikesamuel
Copy link
Contributor

tc39/ecma262#1504 would fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants