Skip to main content

require-codeql-actions-read

Rule catalog ID: R099

Targeted pattern scopeโ€‹

Jobs that use CodeQL actions such as init, analyze, autobuild, or upload-sarif.

What this rule reportsโ€‹

This rule reports CodeQL jobs that do not grant actions: read.

Why this rule existsโ€‹

CodeQL jobs commonly need actions: read for workflow metadata and action access. Requiring it explicitly keeps job permissions self-documenting and consistent.

โŒ Incorrectโ€‹

permissions:
contents: read

โœ… Correctโ€‹

permissions:
actions: read
contents: read

Additional examplesโ€‹

This rule is job-scoped: it only evaluates jobs that actually use CodeQL actions, not unrelated workflow jobs.

ESLint flat config exampleโ€‹

import githubActions from "eslint-plugin-github-actions-2";

export default [githubActions.configs.codeScanning];

When not to use itโ€‹

Disable this rule if your CodeQL setup demonstrably works without actions: read and you intentionally prefer the smaller permission set.

Further readingโ€‹