Skip to content

feat: add opt-in require-permissions rule - #32

Merged
jdx merged 2 commits into
mainfrom
feat/require-explicit-permissions
Oct 5, 2026
Merged

jdx merged 2 commits into
mainfrom
feat/require-explicit-permissions

Conversation

@jdx

@jdx jdx commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

What

Adds an opt-in require-permissions: true config option and a require-permissions rule. Off by default; zero behavior change unless enabled.

Upstream: rhysd/actionlint#728, rhysd/actionlint#525.

Semantics

  • A job is accepted if the workflow has top-level permissions: OR the job has its own permissions:.
  • permissions: {} counts as explicit (it is the recommended "no permissions" form).
  • Reusable-workflow call jobs (uses:) are checked the same way, since the caller caps the callee's token.
  • Reported per job, at the job position (the AST has no workflow position, and per-job output shows exactly what needs fixing). A workflow with a top-level permissions: never produces noise.

Review notes

  • Rule is always registered but no-ops when the option is off (same pattern as require-commit-hash).
  • Tests: table test covering enabled/disabled for workflow-level, job-level, empty, mixed, and reusable-call cases; testdata/err/*_require_permissions.yaml (suffix enables the option in the lint test harness); SARIF golden updated; docs in checks.md and config.md.
  • rule_runner_label_test.go had an unkeyed String{...} literal that no longer compiled on main (the struct gained a field); fixed with keyed fields since the test package could not build otherwise. Other PRs may carry the same one-line fix.

Caveats

  • Inconsistent with default-permission policy: organizations whose default token is already read-only may find this redundant; that is why it is opt-in.
  • Does not inspect permission contents (e.g. write-all passes); that is a separate concern.

🤖 Generated with Claude Code


Note

Low Risk
Opt-in and off by default; only adds a new lint path when enabled, with no change to existing permission syntax validation.

Overview
Adds an opt-in require-permissions config flag and a matching require-permissions lint rule so teams can enforce explicit GITHUB_TOKEN scoping. With require-permissions: true, each job must be covered by workflow-level permissions: or its own; permissions: {} counts as explicit, and reusable-workflow call jobs are checked the same way. The rule is always registered but no-ops when the option is off, so default runs are unchanged.

Documentation (checks.md, config.md), table and golden-file tests, SARIF rule metadata, and lint harness support for *_require_permissions fixtures are included. A one-line keyed String{...} fix in rule_runner_label_test.go restores compilation after a struct field change.

Reviewed by Cursor Bugbot for commit 8221f37. Bugbot is set up for automated code reviews on this repo. Configure here.

Report jobs that are covered by neither a workflow-level nor a job-level permissions section.

Also fix a keyed String literal in rule_runner_label_test.go that broke test builds on main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Central YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7c9f2bd1-b82a-4ecd-bd4a-9a7bc1f7f62c
📥 Commits

Reviewing files that changed from the base of the PR and between cddd34b and 8221f37.

⛔ Files ignored due to path filters (1)
  • testdata/err/missing_permissions_require_permissions.out is excluded by !**/*.out
📒 Files selected for processing (10)
  • config.go
  • docs/checks.md
  • docs/config.md
  • linter.go
  • linter_test.go
  • rule_require_permissions.go
  • rule_require_permissions_test.go
  • rule_runner_label_test.go
  • testdata/err/missing_permissions_require_permissions.yaml
  • testdata/format/test.sarif
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jdx
jdx merged commit 736d914 into main Oct 5, 2026
15 of 16 checks passed
@jdx
jdx deleted the feat/require-explicit-permissions branch October 5, 2026 02:12
@jdx jdx mentioned this pull request Oct 5, 2026
jdx added a commit that referenced this pull request Oct 5, 2026
🤖 I have created a release *beep* *boop*
---


## [1.8.0](v1.7.12...v1.8.0)
(2026-10-05)


### Features

* `workflow_dispatch` allows 25 inputs
([38dfd8e](38dfd8e))
* add config-secrets option to allow-list secrets
([#16](#16))
([b00331b](b00331b))
* add inline ignore comments
([#23](#23))
([e4dee7a](e4dee7a))
* add opt-in check for local actions used before checkout
([#29](#29))
([34f436a](34f436a))
* add opt-in check for workflow_run workflow names
([#30](#30))
([a9d60af](a9d60af))
* add opt-in require-expression-wrapping and check-falsy-ternary
([#25](#25))
([075f8b8](075f8b8))
* add opt-in require-permissions rule
([#32](#32))
([736d914](736d914))
* add opt-in require-shell and max-run-lines checks
([#26](#26))
([7d1db16](7d1db16))
* add opt-in timeout-check rule for job timeout-minutes
([#24](#24))
([bb70379](bb70379))
* add self-hosted-runner.strict-labels config option
([#21](#21))
([a9a4ce0](a9a4ce0))
* add support for 'code-quality' permission
([d147267](d147267))
* detect caller/callee permission mismatch in reusable workflow calls
([#13](#13))
([6699dde](6699dde))
* detect more attacker-controlled script injection inputs
([#22](#22))
([c962011](c962011))
* import upstream actionlint PRs and fix upstream issues
[#747](https://github.com/jdx/jactionlint/issues/747)-[#750](https://github.com/jdx/jactionlint/issues/750)
([#11](#11))
([143400e](143400e))
* load user-global config from XDG_CONFIG_HOME
([#15](#15))
([c72f98b](c72f98b))
* opt-in require-commit-hash lint
(rhysd/actionlint[#436](https://github.com/jdx/jactionlint/issues/436))
([#19](#19))
([acbebb1](acbebb1))
* opt-in required-actions rule (upstream
[#474](https://github.com/jdx/jactionlint/issues/474))
([#17](#17))
([717783d](717783d))
* **shellcheck:** map errors to source lines in literal blocks
([#18](#18))
([5d3c39a](5d3c39a))
* support parallel steps (background, wait, wait-all, cancel, parallel)
([#12](#12))
([35ddf4a](35ddf4a))
* support windows-11-vs2026-arm runner
([5231ce6](5231ce6))
* Support YAML anchors and aliases in parser
([8ed4c46](8ed4c46))
* workflow_dispatch allows 25 inputs
([673e4d3](673e4d3))


### Bug Fixes

* accept boolean wait-all and type-check parallel step expressions
([#31](#31))
([cddd34b](cddd34b))
* add artifact-metadata
([ff3994b](ff3994b))
* add artifact-metadata
([c2e42cf](c2e42cf))
* add documented job workflow context properties
([f6542f4](f6542f4))
* Add undocumented github.repository_visibility option
([c391460](c391460))
* Add undocumented github.repository_visibility option
([a533631](a533631))
* add windows-11-arm to runner os
([180ef9e](180ef9e))
* check matrix exclude values against matrix rows only
([#20](#20))
([65dfbe2](65dfbe2))
* repair main's runner label test after concurrent merges
([#27](#27))
([ada1320](ada1320))
* report correct position for expression errors in literal blocks
([#28](#28))
([2df981e](2df981e))
* Validating permission scopes: id-token and models
([9510b01](9510b01))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Version and documentation-only release PR from Release Please; no
runtime code changes in the diff, though upgrading to 1.8.0 may surface
new linter findings for consumers.
> 
> **Overview**
> **Release 1.8.0** — bumps the project version from `1.7.12` to `1.8.0`
in `.release-please-manifest.json`, the pre-commit Docker hook
(`ghcr.io/jdx/jactionlint:1.8.0`), `docs/usage.md` examples, and the
playground version badge/link.
> 
> `CHANGELOG.md` gains a new **1.8.0** section (features and fixes from
the release train) and older release headings are normalized from `#` to
`##` for consistent markdown structure.
> 
> The substantive product changes in this release (new opt-in lint
rules, parallel steps, inline ignores, permission/security checks, etc.)
are documented in the changelog; this PR does not modify linter source
in the diff shown.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4632529. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant