Skip to content

fix: add least-privilege GITHUB_TOKEN permissions to workflows#3080

Open
sammdec wants to merge 3 commits into
mainfrom
fix/workflow-token-permissions
Open

fix: add least-privilege GITHUB_TOKEN permissions to workflows#3080
sammdec wants to merge 3 commits into
mainfrom
fix/workflow-token-permissions

Conversation

@sammdec

@sammdec sammdec commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves the 28 actions/missing-workflow-permissions code-scanning alerts (including #44). None of the workflows declared an explicit permissions block, so every job ran with the broad default GITHUB_TOKEN.

Each workflow now sets a least-privilege top-level default (contents: read), and individual jobs are elevated only to what they actually use:

Workflow Job Scope Why
build-fork, i18n-check, crowdin-upload/download contents: read build/test/checkout only; crowdin uses BOT_TOKEN
build-test-deploy-dev next_js_analyze pull-requests: write bundle-analysis PR comment
build-test-deploy next_js_analyze pull-requests: write bundle-analysis comment
build-test-deploy prepare_release, prepare_release_no_cypress contents: write calls the release workflow
update-prod-staging deploy contents: write creates a GitHub release
test-deploy-fork prepare_jobs, next_js_analyze, deploy_fork actions: read + pull-requests: write download artifacts from the triggering run + PR comments
test-deploy-fork notify_success, notify_failure pull-requests: write + issues: write update CI comment + add/remove CI label

Notes

  • No changes to any job's steps — permissions only.
  • dependency-review.yml already declared permissions and wasn't flagged; left untouched.
  • All 8 files re-validated as parseable YAML with valid permission scopes.

Test plan

  • CI green on this PR (exercises the PR-triggered workflows and their comment jobs)
  • Code-scanning re-run clears the 28 alerts
  • Post-merge: confirm the push-triggered deploy + release flow still comments/releases

🤖 Generated with Claude Code

Resolves the 28 `actions/missing-workflow-permissions` code-scanning
alerts. Every workflow now declares an explicit top-level permissions
block (default `contents: read`), with individual jobs elevated only to
what they actually need:

- next_js_analyze / prepare_jobs / deploy_fork: pull-requests: write
  (post PR comments); +actions: read where they pull artifacts from the
  triggering run (workflow_run).
- notify_success / notify_failure: pull-requests: write + issues: write
  (update comment + add/remove CI label).
- prepare_release[_no_cypress] + update-prod-staging: contents: write
  (create the GitHub release).
- crowdin upload/download authenticate via BOT_TOKEN, so GITHUB_TOKEN
  stays read-only.

No behavioural change to any job's steps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@odin-by-borg

odin-by-borg Bot commented Jul 23, 2026

Copy link
Copy Markdown

Mjolnir Security Review

New commits since last review at 3770d5c.

Run Mjolnir Review


3 PRs reviewed

@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
interface Ready Ready Preview, Comment Jul 23, 2026 9:55am

Request Review

@github-actions

Copy link
Copy Markdown

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 1.32 MB (-14 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

The aave/pinata-action leaves a deployment comment using github.token:
issues.createComment on pull_request events, repos.createCommitComment
otherwise. The default contents:read broke the deploy jobs.

- build-test-deploy-dev deploy (pull_request): + pull-requests: write
- build-test-deploy deploy (push): contents: write (commit comment)
- test-deploy-fork deploy_fork (workflow_run): contents: read -> write
  (commit-comment branch), keeping actions: read + pull-requests: write

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1.32 MB (🟡 +1 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

build-test-deploy.yml only runs on push to main, where
github.event.pull_request.number is empty, so these
secrets[format('FORK_..._{0}', ...)] lookups resolved to empty
non-existent secret names and did nothing. Removing them clears three
actions/excessive-secrets-exposure alerts (the dynamic indexing forced
the whole secrets context onto the runner) with no behavioural change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 1.32 MB (-14 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

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.

2 participants