With the setup that you created in the earlier challenges, we will run the query to show all function calls. You can either use the codespace with VS Code, or use VS Code locally.
- In the CodeQL tab, check that you have the
GitHubSecurityLab/codeql-zero-to-herodatabase downloaded and selected. There should be a checkmark next to the database name. If there isn't, hover over the database name until 'Select' button appears, then press that button. - If you haven't downloaded the database for this repository, go to the CodeQL tab and click on choose the “Download database from GitHub” option, the one with the GitHub logo. This option allows you to specify any public repo on GitHub to download as a CodeQL database - as long as it uses one of the supported languages by CodeQL. Write
GitHubSecurityLab/codeql-zero-to-heroand press Enter.
- Got to the 'Explorer' tab and create a new file in the
codeql-custom-queries-pythonfolder. Call the filecall.qland copy the below query into the file.
import python
from Call call
where call.getLocation().getFile().getRelativePath().regexpMatch("2/challenge-1/.*")
select call- Hover over
Callin the third line. This will show you the definition of theCalltype. You can always hover over any part of the query to see if there is a definition for it. - Right click anywhere in the writing area of the query file and choose "CodeQL: Run Query on Selected Database"
- After a few seconds you should see results, like so:


