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
Fully qualified names #16352
Comments
Thank you for the question! The error message is correct - from CallExpr c
where c.getCallee().(PropAccess).getQualifiedName().matches("app.post")
select c, c.getLocation(), c.getCalleeName() |
@ginsbach thanks ! Is there an option to match |
Try this API::moduleImport("express").getMember("post") The JavaScript analysis does not operate with fully qualified names, instead we rely on identifying the of access paths that lead to the desired endpoint. |
I can't make a properly typed query 😬
yields the following error:
Attempt 2:
Yields this error:
What am I missing ? |
When I look at the docs, there isn't anything similar, though |
Try |
Still no go - no type errors, but I get an empty table:
and the table I get is:
And there is a call for express.post: source |
The Try comparing it to the call expression itself from CallExpr c
where c = API::moduleImport("express").getMember("post").getACall().asExpr()
select c, c.getLocation(), c.getCalleeName() Or just select API::moduleImport("express").getMember("post").getACall() |
Guys, thanks. I'm still getting an empty table though 😬
And here is my output:
|
Sorry, I misread you example code, we need a select API::moduleImport("express").getReturn().getMember("post").getACall() I'd suggest trying to quick-eval the individual pieces of the above CodeQL expression to get some intuition about what it does. |
It works ! Thanks for all the guidance ! |
@asgerf should I close this issue ? |
Yes, closing issue |
I'm looking for fully qualified name calls for
express.post
1 :I can get all calls containing the word
post
:And it works great:
When I try to use the fully qualified name predicate it doesn't work:
Here is the error that I get:
1 The complete code is here
The text was updated successfully, but these errors were encountered: