How to point CodeQL to source code for 3rd party/precompiled libraries? #275
-
[C/C++] I'm trying to get it to work by setting up a database for CodeQL manually with glibc checked out in the repository and linking against that, but since glibc is still built before the rest (I'm testing this with coreutils), I don't have a lot of hope. I could also modify the coreutils buildsystem to build glibc as part of it and then hope CodeQL picks up on it when it generates the database and compiles the repo? What would you suggest in this case? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Your best bet if you really want to go down this route is indeed to build all the dependencies you want to include in the database as part of the database creation. CodeQL will pick up the compiler invocations that happen while the build command/script you provide runs, and reflect all processed source in the database (with appropriate compiler settings, target platforms, include paths, and so on). Without that information, we can't create a sufficiently accurate model of C/C++ code. Having said that, our default assumption about external calls is actually that they do not propagate taint -- our CodeQL libraries provide explicit models for many common APIs that are relevant to data flow analysis and taint tracking. It may be that you can achieve what you're after through explicit modelling of relevant APIs, if you can't build them as part of the same script. |
Beta Was this translation helpful? Give feedback.
Your best bet if you really want to go down this route is indeed to build all the dependencies you want to include in the database as part of the database creation. CodeQL will pick up the compiler invocations that happen while the build command/script you provide runs, and reflect all processed source in the database (with appropriate compiler settings, target platforms, include paths, and so on). Without that information, we can't create a sufficiently accurate model of C/C++ code.
Having said that, our default assumption about external calls is actually that they do not propagate taint -- our CodeQL libraries provide explicit models for many common APIs that are relevant to data flow a…