GitHub CodeQL Executor¶
Category: Source Code Analysis
Script: codeql.py
Integration: GitHub REST API
Faraday Plugin: Raw JSON (no plugin — generates Faraday JSON directly)
Website: https://codeql.github.com/
Description¶
Fetches all open code-scanning alerts (typically from CodeQL analysis) for a GitHub repository via the GitHub REST API. Each alert is enriched with description, file location, CWE identifiers, and references. Results are grouped by file path in Faraday.
Prerequisites¶
- GitHub Personal Access Token with
security_eventsscope - GitHub Advanced Security (GHAS) enabled on the repository
- CodeQL analysis configured and running (typically via GitHub Actions)
Configuration¶
Environment Variables (Setup)¶
| Variable | Required | Description |
|---|---|---|
GITHUB_TOKEN |
Yes | GitHub Personal Access Token |
GITHUB_OWNER |
Yes | GitHub organization or user owning the repository |
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
GITHUB_REPOSITORY |
string | Yes | Repository name to query for code scanning alerts |
Common Agent Parameters Supported¶
AGENT_CONFIG_VULN_TAG, AGENT_CONFIG_HOSTNAME_TAG
YAML Configuration Example¶
executors:
codeql_scan:
repo_executor: codeql.py
max_size: 65536
varenvs:
GITHUB_TOKEN: "${GITHUB_TOKEN}"
GITHUB_OWNER: my-org
params:
GITHUB_REPOSITORY:
mandatory: true
type: string
base: string
How It Works¶
- Fetches all open code-scanning alerts from
https://api.github.com/repos/{owner}/{repo}/code-scanning/alerts(paginated) - For each alert, retrieves detailed information including:
- Rule description and help text
- File path and line number of the finding
- CWE identifiers
- CVE identifiers (if applicable)
- Severity and external references
- Groups findings by file path (each file becomes a host as
{owner}/{repo}/{path}) - Outputs the combined Faraday JSON
Notes¶
- Only open alerts are imported; dismissed or fixed alerts are excluded
- This executor imports results from any code-scanning tool configured on the repository, not just CodeQL
- The GitHub token must have access to the repository's security features
- GitHub Advanced Security is required for private repositories; code scanning is free for public repositories