Explicitly set permissions for the tokens used in github action workflows
- Dominant language
- PHP
- Stars
- 156
- Forks
- 72
- Avg merge
- 12h 43m
- Merged PRs (30d)
- 203
Description
_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_
**Set explicit minimal permissions for the workflow.**
The workflow uses default permissions, which grants broad access to the GITHUB_TOKEN. Static analysis correctly identifies this as an excessive-permissions concern. Following the principle of least privilege, explicitly declare minimal permissions.
🔒 Proposed fix to add minimal permissions
```diff
name: 'Tests: All End-to-End (including non-mature)'
+permissions:
+ contents: read
+
on:
workflow_dispatch:
schedule:
```
If the reusable workflows need additional permissions, declare them in those workflows instead of granting them at this level.
🧰 Tools
🪛 zizmor (1.25.2)
[warning] 1-46: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🤖 Prompt for AI Agents
```
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/e2e-tests-all.yml around lines 1 - 9, Add an explicit
minimal permissions block to this workflow (the workflow named 'Tests: All
End-to-End (including non-mature)') instead of relying on default GITHUB_TOKEN
permissions; update the top-level YAML to include a permissions mapping that
grants only the specific scopes required (for example: actions: read, contents:
read, checks: read — or narrower as actually needed), and remove any broad or
default permissions; if any reusable workflows invoked by this file need extra
scopes, declare those additional permissions inside those reusable workflow
files (not here).
```
_Source: Linters/SAST tools_
_Originally posted by @coderabbitai[bot] in https://github.com/ecamp/ecamp3/pull/9969#discussion_r3369502977_
Contributor guide
Research direction
Open .github/workflows/e2e-tests-all.yml and inspect the workflow and any reusable workflows it invokes to identify the permissions actually required. Add an explicit minimal permissions mapping at the workflow level, keeping any additional reusable-workflow permissions there, then run zizmor or the repository’s workflow checks. Done means the excessive-permissions warning is resolved without unnecessary token scopes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd, security
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100