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:- File extensions (base: 0.3)
- Build files (+0.2 per file, max +0.4)
- Structural indicators (+0.1 per indicator, max +0.3)
- 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.xml→mvn clean compile -DskipTests - Gradle:
build.gradle→gradle clean build -x test
- CMake:
CMakeLists.txt→cmake . && make - Make:
Makefile→make - Autotools:
configure→./configure && make
- npm:
package.json→npm install && npm run build - Yarn:
yarn.lock→yarn install && yarn build
- Go modules:
go.mod→go build ./...
- 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
Fromcore.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:- Sanitizers: Are they truly effective?
- Reachability: Is the path reachable in practice?
- Barriers: Are there hidden constraints?
- Complexity: What’s the real attack difficulty?
Validation Output
Dataflow Visualization
Generate visual representations of dataflow paths:- 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- Detect languages
- Detect build systems
- Create databases
- Execute security queries
- Generate SARIF output
- LLM-powered finding analysis
- Dataflow path validation
- Exploitability scoring
- PoC generation
- Exploit compilation
Autonomous Analyzer
Deep analysis of findings:Output Structure
Workflow Results
CodeQLWorkflowResult
Accessing Results
Best Practices
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-latestis used - Check
codeFlowsfield in SARIF output - Some queries don’t produce dataflow (e.g., pattern-based)
Out of Memory
Increase CodeQL RAM allocation:See Also
- Static Analysis - Semgrep pattern-based scanning
- Exploitability Validation - Verify findings
- Binary Fuzzing - Dynamic testing