Skip to content
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

CodeQL cannot resolve some classes and methods #18648

Open
ArtiomKr opened this issue Feb 1, 2025 · 3 comments
Open

CodeQL cannot resolve some classes and methods #18648

ArtiomKr opened this issue Feb 1, 2025 · 3 comments
Labels
awaiting-response The CodeQL team is awaiting further input or clarification from the original reporter of this issue. question Further information is requested

Comments

@ArtiomKr
Copy link

ArtiomKr commented Feb 1, 2025

I just started using CodeQL and faced with the problem that the extension does not see some classes. What could be the problem?

Image

CodeQL extension version: 1.17.1
CodeQL CLI version: 2.20.0
Platform: linux x64

@ArtiomKr ArtiomKr added the question Further information is requested label Feb 1, 2025
@intrigus-lgtm
Copy link
Contributor

There is an old interface for the data flow library and a new one.
The old interface has been deprecated last December I believe.

See here for information on how to convert from the old version to the new one:
https://github.blog/changelog/2023-08-14-new-dataflow-api-for-writing-custom-codeql-queries/

@ArtiomKr
Copy link
Author

ArtiomKr commented Feb 3, 2025

Thanks, you were right. However, after copying the example, I came across new errors, which, as I understand it, should not be. Could it have something to do with some additional import?

Image

And is it possible to use the old API? Which versions of CodeQL extension and CodeQL CLI are needed for this?

@redsun82
Copy link
Contributor

redsun82 commented Feb 5, 2025

👋 @ArtiomKr

The example in the blog post was meant to showcase the changes in the dataflow API (the part where we need to implement DataFlow::ConfigSig, with its predicates isSource and isSink). The actual implementation of those predicates still needs to use the specific language API, which is different from language to language. The example in the blog post was done with Java, so it is expected that copying that example with an import cpp won't compile.

In your case you need to use the C/C++ library. You can probably just copy and paste the isSource and isSink bodies you posted in your initial question as the bodies of the same predicates in a module block implementing DataFlow::ConfigSig.

Here's some further documentation that you might find useful:

@redsun82 redsun82 added the awaiting-response The CodeQL team is awaiting further input or clarification from the original reporter of this issue. label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-response The CodeQL team is awaiting further input or clarification from the original reporter of this issue. question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants