eval where the argument is user-controlled.
eval() call, flagging dangerous sinks such as unsanitized SQL concatenation or dynamic evaluation.
Example vulnerable server code:
q is interpolated directly into the SQL string.
How CodeQL analyzes different languages
- For interpreted languages like Python, JavaScript, and Ruby, CodeQL reads and analyzes the source files directly.
- For compiled languages such as Java, C++, and Go, CodeQL must observe a successful build to understand how the final program is constructed. It hooks into your compiler and build system to extract semantic artifacts. If the build fails, analysis cannot proceed.


For compiled languages, ensure your CI environment reproduces the build steps CodeQL needs (including required toolchains and build flags). If the analyzer can’t build the project, it can’t extract the semantic data needed for accurate analysis.
If your CodeQL workflow is failing due to build errors, make that failure actionable in CI. Treat the build + analysis status checks as required on protected branches so broken builds (and therefore incomplete analyses) block merges until resolved.
Best practices and next steps
- Integrate CodeQL into GitHub Actions: follow the official guide to add the CodeQL analysis workflow and automate scans on push and pull requests. See the CodeQL docs for setup details: https://docs.github.com/en/code-security/code-scanning/using-codeql-code-scanning
- Make the CodeQL workflow a required status check on protected branches so build failures or new, unaddressed alerts block merges.
- For compiled projects, ensure CI reproduces your local build: include necessary toolchains, environment variables, and build flags.
- Customize or write CodeQL queries tailored to your codebase to reduce false positives and find risky data-flow paths unique to your application logic.
- CodeQL docs: https://docs.github.com/en/code-security/code-scanning/using-codeql-code-scanning
- GitHub Code Scanning overview: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors
- GitHub Actions docs: https://docs.github.com/en/actions