Skip to main content

Overview

RAPTOR’s CodeQL integration provides fully autonomous semantic analysis with automatic language detection, build system detection, database creation, and security query execution.

Architecture

CodeQL analysis consists of multiple specialized components:

Language Detection

Automatic Detection

The language detector scans repositories and assigns confidence scores:

Detection Algorithm

Confidence scoring factors:
  1. File extensions (base: 0.3)
  2. Build files (+0.2 per file, max +0.4)
  3. Structural indicators (+0.1 per indicator, max +0.3)
  4. File count ratio (up to +0.3)

Supported Languages

CodeQL-supported languages:

Language Filtering

Filter to CodeQL-supported languages only:

Build System Detection

Automatic Build Detection

The build detector identifies appropriate build commands:

Supported Build Systems

Java:
  • Maven: pom.xmlmvn clean compile -DskipTests
  • Gradle: build.gradlegradle clean build -x test
C/C++:
  • CMake: CMakeLists.txtcmake . && make
  • Make: Makefilemake
  • Autotools: configure./configure && make
JavaScript/TypeScript:
  • npm: package.jsonnpm install && npm run build
  • Yarn: yarn.lockyarn install && yarn build
Go:
  • Go modules: go.modgo build ./...
Python/Ruby:
  • No-build mode (interpreted languages)

Custom Build Commands

Override auto-detection:

Database Creation

Autonomous Database Creation

CodeQL databases are created with automatic caching:

Database Caching

Databases are cached to avoid redundant creation:

Database Structure

Cache Management

Query Execution

Security Suites

RAPTOR uses CodeQL’s security suites:

Parallel Query Execution

Query Configuration

From core.config.RaptorConfig:

Dataflow Validation

Dataflow Path Structure

CodeQL findings include source-to-sink dataflow paths:

LLM-Powered Validation

Go beyond static detection to validate exploitability:

Validation Criteria

The validator checks:
  1. Sanitizers: Are they truly effective?
  2. Reachability: Is the path reachable in practice?
  3. Barriers: Are there hidden constraints?
  4. Complexity: What’s the real attack difficulty?

Validation Output

Dataflow Visualization

Generate visual representations of dataflow paths:
Output formats:
  • GraphViz DOT - Graph structure
  • PNG - Rendered visualization
  • HTML - Interactive web view

CLI Usage

Fully Autonomous Scan

Auto-detect everything:

Specify Languages

Target specific languages:

Extended Security Suite

Use more comprehensive queries:

Force Database Rebuild

Ignore cache:

Scan Only (No LLM Analysis)

Skip autonomous analysis phase:

Custom CodeQL CLI Path

Autonomous Analysis

Two-Phase Workflow

Phase 1: Scanning
  1. Detect languages
  2. Detect build systems
  3. Create databases
  4. Execute security queries
  5. Generate SARIF output
Phase 2: Analysis
  1. LLM-powered finding analysis
  2. Dataflow path validation
  3. Exploitability scoring
  4. PoC generation
  5. Exploit compilation

Autonomous Analyzer

Deep analysis of findings:

Output Structure

Workflow Results

CodeQLWorkflowResult

Accessing Results

Best Practices

Cache databases: Database creation is expensive (5-30 minutes). Let CodeQL cache databases between runs unless source code changes.
Resource requirements: CodeQL analysis needs significant resources. Configure CODEQL_RAM_MB based on your system (minimum 4GB, recommended 8GB).
Build requirements: Compiled languages (Java, C/C++, C#) require build tools installed. CodeQL traces compilation to understand code structure.

Troubleshooting

Database Creation Fails

No Dataflow Paths

If queries return findings without dataflow:
  • Ensure --format=sarif-latest is used
  • Check codeFlows field in SARIF output
  • Some queries don’t produce dataflow (e.g., pattern-based)

Out of Memory

Increase CodeQL RAM allocation:

See Also