-
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
Question about Cross-files invocation and analyze for functions in a certain NodeJS module #41
Comments
Unfortunately, SAFE does not support module systems, such as We are sorry for the insufficient documentation of SAFE. If a call block does not have any abstract states in the current semantics, it means that this call block is unreachable. It should have at least one abstract state with different trace partitions if it is reachable. Thanks! |
Thank you a lot for that information, which is really helpful. I still have one question about the analysis of the functions. I was wondering whether only the invoked functions will be analyzed in SAFE. For example, there may be a lot of exported functions in a certain package like aws-lambda, and those functions are not invoked in the codes anywhere. I was thinking about whether the SAFE will not analyze their codes to find possible bugs in those functions. I tested the following code but the SAFE did not respond to any bug information. I was wondering whether there are any possible configurations to enforce SAFE go into those uninvoked functions or if it is not implemented in SAFE. function test(a){
if (true) return a;
else return "something else";
}
module.exports = {test} Many thanks |
I am also curious about how the call block works in ControlFlowGraph. I read the codes of a forked version. I realized that the It seems like there is not a precise "link" from the call block to the callee. From my understanding, the CallBlock only contains the CallInstruction, with call expression. There are no references implying the callee CFGFunction object. I was wondering whether it is possible to directly find the callee from the ControlFlowDiagram without any instances of the |
As you know, JavaScript is a highly-dynamic programming language. Thus, it is not easy to analyze a JavaScript function without any knowledge of the arguments. The number of arguments might vary. Different types of arguments might be accepted. Functions and even proxied objects with complex handlers might be given to a simple function. How about the analysis of this simple function: function f(a, b) { return a + b; } What's the expected analysis result of this function? A numeric addition? A string concatenation? A function call to other user functions? Is it possible to throw an error? If so, when? So, I think it is almost impossible to precisely cover all the possible scenarios without any knowledge of the arguments. If the given program is written in TypeScript, it becomes a much easier problem by using given argument types. But, for JavaScript, it is difficult to analyze functions without the information of arguments.
In JavaScript, functions are values. Consider the following example: ...
function f(g) { g(); }
... In the body of the function |
Dear developers of SAFE,
I notice that safe accepts multiple JS files as inputs, so I was wondering whether the SAFE is able to handle the model and some functions in NodeJS like module.exports and requires("...") to invoke some functions in different files.
Besides, I am confused about how the CallInstructions are handled in SAFE. I noticed there are some methods like
sematic.CI
andsemantics.getCallInfo
. Those two functions requireTracePartition
as a parameter, but the output ofsematic.getState(callBlock)
always be Nil. I was wondering whether there are any development documents or examples of their usage.Many thanks,
The text was updated successfully, but these errors were encountered: