What this thread does
Enable CodeQL for Rust with build mode none, and verify successful source extraction before treating an empty findings list as meaningful.
Do first: select Rust in CodeQL repository settings
GitHub's build-mode reference lists code scanning for public repositories and eligible organisation repositories with GitHub Code Security enabled. For a private repository, confirm entitlement first; do not assume a public-repository setup implies a free private scan. Actions usage may have separate billing.
Set up the scan
1. Open the repository's code-security settings and configure CodeQL. Select Rust when using default setup. Use advanced setup if you need an explicit workflow or extra language jobs; keep only one intended setup active. 2. In the generated advanced workflow, keep checkout and the required permissions. Set the CodeQL language to rust and the build mode to none. GitHub's current workflow configuration reference uses the stable github/codeql-action v4 action line, checked 2026-10-28. The relevant step is:
- uses: github/codeql-action/init@v4
with:
languages: rust
build-mode: none
- uses: github/codeql-action/analyze@v4
This is a fragment for the generated workflow, not a complete workflow. Keep its pull-request/default-branch triggers, runner, checkout and security-events write permission. Do not grant arbitrary pull-request code broader credentials. 3. Keep a Cargo.toml or rust-project.json available in the checked-out source. The Rust build reference requires rustup and cargo; ensure they exist on a self-hosted runner. 4. Let the initial run finish. Inspect extraction diagnostics, the analysed language and uploaded analysis results. A green unrelated CI job or an empty Security tab does not establish that Rust was scanned. 5. Add a separate normal Cargo build/test job for your supported features and targets. Buildless SAST does not replace your compiler and tests.
What the result covers
CodeQL's support table lists Rust editions 2021 and 2024, checked 2026-10-28. The extractor uses rust-analyzer, can execute build scripts and compile macro code, and does not perform a full build. Run analysis on appropriately isolated runners: none does not mean no repository code can execute.
CodeQL is for source-level security findings. A dependency advisory checker answers a different question, and Clippy findings are not proof of SAST coverage. Keep those checks separately if required by your project.
Fit, cost and recommendations
Pick CodeQL if Rust is supported in your repository and you want security findings integrated with GitHub review. It loses when your repository lacks entitlement or your required code/features are outside extractor coverage. The current docs establish eligibility, not a universal per-scan dollar price; consult account billing before expanding runner usage.
Solo/public project default: default setup with Rust. Small-team default: the same unless explicit workflow control is needed. Enterprise default: an isolated supported runner, managed action pinning and a documented inventory of features/targets that analysis does and does not cover.
Diagnostic: Rust does not support the manual build mode
Use none for the Rust entry rather than copying another language's manual Cargo build into CodeQL's extraction mode. Keep ordinary Cargo compilation in its own CI check.
Public evidence
kristof-mattei, GitHub Community #161754, 2025-07-02: “Rust does not support the manual build mode.” This historical setup failure agrees with the current Rust build-mode reference; it is not an assessment of detection quality.
A prompt for the agent
Add Rust CodeQL scanning through the repository's supported setup. Use build mode none, preserve least-privilege permissions and keep Cargo tests separate. Show extraction diagnostics and the uploaded Rust analysis before interpreting alerts. Identify unsupported features or generated code.
Mistakes and limits
Do not select only another language, infer security from zero alerts, or run untrusted build scripts on a privileged shared runner. No workflow or detection test was run. This recipe does not establish complete vulnerability coverage, feature-matrix coverage or private-repository pricing. checked 2026-10-28.
Started from a post by @GitHub, packaged by the editor. Original post