-
Notifications
You must be signed in to change notification settings - Fork 1
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
Reachability analysis failed for jest-environment-jsdom@28.1.3 and tough-cookie@4.0.0 #64
Comments
Thank you for reporting this! This uncovers a few issues on our end.
|
@dappelt can you verify that this solved the issue for you? |
@andreaphylum @louislang thanks for the quick response. There are still some problems. I tested the new release with an adjusted configuration
Running vuln-reach with this config now returns the error:
This seems to be the expected behavior with the changes that @andreaphylum described in his last comment:
I wonder if this behavior is correct for this vulnerability though. In javascript the curly bracket has several uses; it indicates the start of a code block OR for object notation. The vulnerability location in the config is referencing the latter. The referenced vulnerable code is: Should this be a valid location? If not, how would you define the location for this example? |
It would not, because in the access graph that we use, vertices are identifier AST nodes and edges are a "A accesses B" relation between identifier AST nodes only. For an arbitrary AST node kind to work as entry point, we should be able to define the "accesses" relation in a generalized fashion, which isn't really feasible due to the undecidable nature of runtime semantics. Maybe a workaround could be built for a few specific kind of nodes to be accepted as sources, but it would not be generalizable without significantly ramping up complexity and introducing hard to track edge cases. It does make things counterintuitive, but I couldn't find a viable alternative unfortunately.
Loosely, any identifier in that same scope would be a good candidate, as any identifier inside of the assignment's scope is marked reachable at the same time as the assignment is reached. |
@andreaphylum Thanks for looking into this. I gave it another try with the identifiers that you suggested.
Config for identifier
Executing the config returns
I get a similar error for the identifier |
@dappelt my bad! I forgot that property identifiers don't actually belong to a scope and we don't have A good proxy would be the name of the function surrounding the statement, i.e. the function foo() {
this.idx[cookie.domain] = Object.create(null);
} Even if the function definition could be not right next to the vulnerable node, the scope is what matters. This could help in the future: you can paste JS code in the tree-sitter playground to determine which nodes have kind Usability here could definitely be improved on our end, by having the first step of the algorithm find the closest identifier and uses that to kick off the rest of the process. |
@andreaphylum Thanks for the clarifications. Checking for access to the function that contains vulnerability is a good compromise between the accuracy of the static analysis and the ease of defining vulnerability locations. But not all functions are of type class MemoryCookieStore extends Store {
putCookie(cookie, cb) {
if (!this.idx[cookie.domain]) {
this.idx[cookie.domain] = {};
}
} This produces the following syntax tree:
|
Yeah, unfortunately class methods aren't statically addressable as they end up as dynamic properties of class objects. |
Description
I ran
vuln-reach-cli
for packagejest-environment-jsdom@28.1.3
which depends ontough-cookie@4.0.0
. This version has the following vulnerability: salesforce/tough-cookie@12d4747?diff=splitI specified in the config file a few of the code locations that were patched , but
vuln-reach-cli
reports an error for all locations that I tried.Reproduction Steps
Create a config
Compile
vuln-reach-cli
and call it with the config from the previous section.Expected Behavior
Reachability analysis does not fail.
Actual Behavior
(Note the line staring with
Reachability failed
)The text was updated successfully, but these errors were encountered: