Define explicit top-level permissions for GitHub Actions workflows#3211
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughAdded explicit top-level Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
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. Comment |
|
Thanks for the clarification. I’ve updated all affected workflows to use permissions: {} at the workflow level and kept all required scopes strictly at the job level, consistent with #3118. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI Agents
In @.github/workflows/update-nest-test-images.yaml:
- Around line 8-9: The job-level permissions only specify an empty permissions
object; update the workflow's job permissions to explicitly allow cache writes
by adding actions: write and keep contents: read so GitHub Actions cache-to
operations succeed; locate the permissions block in the workflow (the top-level
permissions: {} entry in .github/workflows/update-nest-test-images.yaml) and
replace it with a permissions mapping that includes actions: write and contents:
read.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.github/workflows/check-pr-issue.yaml.github/workflows/label-issues.yaml.github/workflows/label-pull-requests.yaml.github/workflows/run-ci-cd.yaml.github/workflows/run-code-ql.yaml.github/workflows/update-nest-test-images.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
- .github/workflows/label-issues.yaml
- .github/workflows/run-ci-cd.yaml
- .github/workflows/run-code-ql.yaml
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-21T19:03:59.068Z
Learnt from: ahmedxgouda
Repo: OWASP/Nest PR: 1139
File: .github/workflows/setup-backend-environment/action.yaml:16-27
Timestamp: 2025-12-21T19:03:59.068Z
Learning: Composite actions (runs: using: composite) execute as steps within the calling job's context and can access the job context, including job.services.* properties (e.g., job.services.<service_id>.id, job.services.<service_id>.ports). Service containers must be defined at the job level, but a composite action's steps can reference them via the job context.
Applied to files:
.github/workflows/label-pull-requests.yaml.github/workflows/update-nest-test-images.yaml.github/workflows/check-pr-issue.yaml
🔇 Additional comments (2)
.github/workflows/check-pr-issue.yaml (1)
8-9: LGTM! Security best practice implemented correctly.The addition of explicit top-level
permissions: {}paired with job-level permission declarations follows GitHub Actions security best practices. This enforces the principle of least privilege by requiring each job to explicitly declare its needed permissions rather than relying on implicit defaults..github/workflows/label-pull-requests.yaml (1)
6-7: LGTM! Consistent security improvement.The explicit top-level permissions block correctly implements the same security pattern as other workflows in this PR. The job-level permissions (
contents: readandpull-requests: write) are appropriately scoped for the labeler action's operations.
|
…WASP#3211) * Define explicit top-level permissions for GitHub Actions workflows * ci: set empty workflow-level permissions and rely on job scopes * ci: allow gha cache writes via job-level actions permission * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
…WASP#3211) * Define explicit top-level permissions for GitHub Actions workflows * ci: set empty workflow-level permissions and rely on job scopes * ci: allow gha cache writes via job-level actions permission * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>



Proposed change
Resolves #3199
This PR adds explicit top-level
permissionsblocks to GitHub Actions workflows that previously relied on implicit defaultGITHUB_TOKENpermissions.The intent is to make CI permission usage explicit and easier to audit, while keeping existing job-level permissions unchanged. This is a non-functional change focused on CI hygiene and security clarity, with no impact on workflow behavior.
Checklist