Repository navigation
chore: harden workflow permissions and standardize GITHUB_TOKEN usage - #5141
Conversation
CommandMC
left a comment
There was a problem hiding this comment.
If pnpm dist or the Flatpak builder requires pushing tags or updating releases via the API, these will fail with a 403
These operations should run fine with the more limited permissions
In general though, you may want to look into what those commands/workflows do, instead of moving that burden to us (understand these workflows were setup years ago, I'd have to re-familiarize myself with them as well)
Thanks for the review and for pointing out that I should dig more into what the workflows actually do. From looking over the workflows touched in this PR and their scripts, my understanding is:
That said, I may still be missing some historical or implicit behavior, so if you know of any of these workflows relying on GitHub‑side write operations that I overlooked, I’m happy to adjust the permissions for those specific cases. |
ce6430e to
d876444
Compare
I've noticed several workflows are running with default permissions and relying on a custom
WORKFLOW_TOKEN. This PR refactors some to follow the principle of least privilege.Changes:
Permissions Hardening: Added
permissions: contents: readto all workflow headers.Token Standardization: Migrated
build-prs.ymlandflatpak-build.ymlfromsecrets.WORKFLOW_TOKENto the built-insecrets.GITHUB_TOKEN.Technical Considerations:
contents: readmitigates potential write-access exploits from compromised dependencies in the build chain.WORKFLOW_TOKENin these files? If the built-inGITHUB_TOKENprovides the necessary scope for PR builds and artifact generation, it seems more logical to use the automatically rotated, short-lived secret.A question on the build logic: I have applied
contents: readbased on the assumption that these workflows are used for validation and artifact storage. Ifpnpm distor the Flatpak builder requires pushing tags or updating releases via the API, these will fail with a 403.Does our current CI flow require write access for these automated checks, or is the restrictive "read-only" state the intended baseline?
Infrastructure / CI Changes
Note: This PR does not modify Backend or Frontend logic, so standard app testing (Login/Install/Play) was not performed. The primary risk is CI permission scoping.