Build: Harden GitHub Actions workflow permissions#119
Conversation
Add explicit permissions and disable credential persistence across all workflows to follow the principle of least privilege.
Thanks for caring and looking further into it btw. |
Summary
permissions: contents: readto all three workflows — previously they inherited the repo default (read+write on all scopes)persist-credentials: falseon allactions/checkoutsteps — no workflow needs git credentials after checkoutpermissions: contents: writeis preserved for creating GitHub releasesWhy
Without an explicit
permissionsblock,GITHUB_TOKENgets read+write access to all scopes (contents, packages, issues, pull-requests, deployments). CI workflows that only build and test should not have write access. Similarly,actions/checkoutpersists credentials in.git/configby default, leaving them accessible to all subsequent steps in the job.