Enable an organization- or enterprise-level default for CodeQL
If CodeQL analysis is not set up for a repository, you can apply a default CodeQL configuration across repositories from the enterprise or organization Advanced Security settings. This allows administrators to choose a default CodeQL setup and runner policy (GitHub-hosted, labeled/self-hosted, or allow repository owners to select). You can also require reviews before alerts can be dismissed by enabling “prevent direct alert dismissal.”Applying an organization- or enterprise-wide CodeQL default helps standardize scanning across repos, but it will cause CodeQL workflows to run in GitHub Actions, which can affect Actions minute usage. Dependabot PRs that trigger CI will also consume minutes.

What the CodeQL setup workflow does
The CodeQL setup workflow adds and runs a GitHub Actions workflow that analyzes your code. Typical high-level steps include:
You can inspect each job step and logs from the Actions run to troubleshoot or confirm configuration details.

Enabling organization-level CodeQL scanning will launch GitHub Actions workflows across affected repositories. Monitor Actions usage and runner selection (GitHub-hosted vs self-hosted) to control costs and capacity.
Reviewing CodeQL results and alerts
When the CodeQL workflow completes, results appear on the repository’s Security and analysis pages (Security and quality → Code scanning). Each alert includes:- Severity and scanner (CodeQL)
- Detection time and provenance
- File path and line number
- Description of the weakness, potential impact, and remediation suggestions
- Links to related alerts, affected branches, and example fixes

Example alert: Uncontrolled data used in path expression (path traversal)
CodeQL often flags patterns where user input is used directly to construct filesystem paths. A vulnerable example:- A malicious
filenamecontaining../or an absolute path may allow access to files outside the intended directory, exposing sensitive data. - CodeQL labels these as “Uncontrolled data used in path expression” or similar.
- Use Express’s
res.sendFilewith therootoption to restrict served files to a known directory:
- Normalize and validate user input to prevent directory traversal:
- Prefer a strict allowlist (recommended) when possible:
Quick remediation table
Next steps and references
- After reviewing an alert: assign it, link to an issue, or create a branch from the alert to implement fixes.
- Monitor CodeQL runs and Actions minute usage to balance security coverage and cost.
- Use organization-level settings to standardize scanning policies and require review before dismissals.