-
Notifications
You must be signed in to change notification settings - Fork 378
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
make infer.js work when eval
is forbidden
#385
Comments
There's about a 5% performance penalty for using the dynamic implementation, since Tern creates a lot of constraints during analysis. For some insane reason, it does not appear to be possible anymore to feature-detect content security policies (there was a Would triggering a security exception once, at the start of the program, catching it, and falling back to the slower method in that case be an okay solution to you? CSP exceptions can be 'reported', though I'm not entirely sure what that means and how much of a problem that is in Chrome Apps. They always get logged to the console, in any case, which is already awkward. |
(I've also sent an email to public-webappsec@w3.org asking why there's no sane way to detect this anymore.) |
Thanks - Yes, that's pretty frustrating... All I can think to do is to search for whether you're in a Chrome Web App or not, but that's probably worse than the 'try it and see' approach. I'd be amazingly happy with any solution that works - thanks for having a look at this! |
Hey, so I'm having to patch this to make Tern work in our Chrome app. I could submit a PR while I'm at it. Is a simple |
Make definitions themselves a bunch more verbose. Issue #385
Attached patch removes the use of |
Thanks for the fix. |
Thanks! It is frustrating about Chrome - I'm not convinced it makes anything more secure either (which I assume was their rationale), as you could just write a JS interpreter in JS and still execute arbitrary code. |
Sadly this is a problem because Google Chrome Web Apps don't allow
eval
orFunction
.There's a thread on this for acorn, and a script has just been contributed which fixes it for that.
Once that is applied, you're left with another failure which is from this code in infer.js which uses
Function.apply
:I've come up with this, which seems to work - however looking more closely at what's being done above I think it's probably wrong, so I'd really appreciate any input.
If it's ok I'd be happy to issue a pull request (however I assume that the original implementation was created for a good reason :) ).
The text was updated successfully, but these errors were encountered: