Skip to main content

Overview

CodeQL builds a relational database from the entire codebase, then runs QL queries against it. This enables deep semantic analysis including cross-file data flow tracking, import analysis, and type hierarchy queries.

Capabilities

  • Cross-file data flow and taint tracking
  • Control flow analysis across function boundaries
  • Import and type hierarchy queries
  • Security, correctness, and maintainability checks
  • Supports C/C++, C#, Go, Java/Kotlin, JavaScript/TypeScript, Python, Ruby, Rust, Swift

Limitations

  • Requires a build process for compiled languages
  • Not applicable to infrastructure or runtime concerns — check out InSpec, Checkov, or Goss for infrastructure validation
  • Not suited for file organization/existence checks

Generated Format

  • Language: CodeQL (QL)
  • Structure: Query files with metadata block (@id, @name, @kind, @problem.severity or @security-severity) and from-where-select clauses
  • Execution: Requires CodeQL CLI and a database built from the codebase

Example Guardrail

Learn more at CodeQL documentation, writing queries, and query metadata.