-
Notifications
You must be signed in to change notification settings - Fork 37
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
idea: static analysis for unexpected throws #40
Comments
Hi @dckc, the tool JSAVER has been a private project because of the double-blinded conference review process. Recently, we accepted the paper and opened it to the public in the following repository: Please look at this repository if you are interested in JavaScript static analysis with evolving language specifications. For the exception analysis you mentioned, I believe it is possible to detect such unexpected throws using SAFE or JSAVER. However, I have two concerns about it. First, it might require manual modeling of opaque code. Many existing real-world JavaScript programs require host-dependent functions, such as DOM APIs or Node.js APIs. Since they are opaque code, we should manually define their modeling to analyze such JavaScript programs. Second, JavaScript static analysis has lower analysis precision than other languages because of the highly-dynamic nature of JavaScript. As a result, it might cause false alarms of unexpected throws. Nevertheless, I believe that we could alleviate it via optimization with reasonable assumptions. |
Excellent! Thank you! This limitation is not a problem for us:
Our system excludes such host-dependent functions: https://agoric.com/documentation/guides/js-programming/hardened-js.html#hardening-javascript-limiting-globals-with-compartments |
TypeScript could help with that. |
In a Jan 17 comment, @jhnaldo writes:
I cannot find JSAVER. Is it shared publicly yet? So this SAFE tool seems to be the closest thing with an open issues list...
I have an idea for a static analysis tool to check for unexpected throws. Expected throws would be denoted as
assert(cond)
orassert.typeof(x, 'string')
orassert.equal(a, b)
or the like. If any code path could lead to a throw other than an explicitassert
, the tool should report that as a problem. I expect this would be extremely valuable in establishing that input validation has been done thoroughly. For example, in issues such as:I would appreciate any thoughts you would like to share on how to go about making such a tool.
Feel free to write to me at [email protected] if you prefer that over a github issue such as this.
cc @erights
The text was updated successfully, but these errors were encountered: