Skip to main content

no-inherit-secrets

Rule catalog ID: R026

Targeted pattern scopeโ€‹

GitHub Actions workflow YAML files that call reusable workflows with jobs.<job_id>.uses.

What this rule reportsโ€‹

This rule reports reusable-workflow jobs that use secrets: inherit.

Why this rule existsโ€‹

GitHub allows secrets: inherit to pass every secret available to the calling workflow into a directly called reusable workflow. Requiring explicitly named secrets keeps reusable-workflow integrations least-privileged and easier to review.

โŒ Incorrectโ€‹

jobs:
deploy:
uses: ./.github/workflows/deploy.yml
secrets: inherit

โœ… Correctโ€‹

jobs:
deploy:
uses: ./.github/workflows/deploy.yml
secrets:
token: ${{ secrets.DEPLOY_TOKEN }}

Additional examplesโ€‹

For larger repositories, this rule is often enabled together with one of the published presets so violations are caught in pull requests before workflow changes are merged.

ESLint flat config exampleโ€‹

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

export default [
{
files: ["**/*.{yml,yaml}"],
plugins: {
"github-actions": githubActions,
},
rules: {
"github-actions/no-inherit-secrets": "error",
},
},
];

When not to use itโ€‹

You can disable this rule when its policy does not match your repository standards, or when equivalent enforcement is already handled by another policy tool.

Further readingโ€‹