fix: add least-privilege permissions to workflows#876
Draft
eniayomi wants to merge 3 commits into
Draft
Conversation
Resolve the actions/missing-workflow-permissions code-scanning warnings by adding explicit permission blocks to each workflow. - cla.yml: pull-requests/statuses write for the CLA bot, actions:write so it can re-trigger itself; signatures repo is written via the PERSONAL_ACCESS_TOKEN, not GITHUB_TOKEN. - conventional-commit-check.yml: pull-requests:read is enough for amannn/action-semantic-pull-request to read the title. - deployment.yml: contents:read for checkout, pull-requests:write for the PR-URL comment job. - lint.yml, safe-apps-check.yml: contents:read. - safe-apps-e2e.yml: actions:write for styfle/cancel-workflow-action, contents:read for checkout.
Org policy requires actions/missing-workflow-permissions PRs to also have every action ref pinned to a full-length commit SHA. Without this, CI fails before running with: 'the action X is not allowed in safe-global/safe-react-apps because all actions must be pinned to a full-length commit SHA'. Pinned to the SHA of the existing tag/branch HEAD to preserve current behavior. Upgrades to newer major versions (checkout v4/v5, setup-node v4, cache v4, etc.) are out of scope for this PR.
The local setup-env composite action references actions/setup-node@v3 and aws-actions/configure-aws-credentials@v1 unpinned, which the 'Pull Request' workflow consumes via ./.github/actions/setup-env. The org SHA-pin policy rejects them too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves the
actions/missing-workflow-permissionswarnings by adding least-privilegepermissionsblocks to all six workflows.cla.yml:pull-requests/statuses: writefor the CLA bot to comment/set status,actions: writeso it can re-trigger itself. Signatures are written to the remote repo via the bot'sPERSONAL_ACCESS_TOKEN, notGITHUB_TOKEN.conventional-commit-check.yml:pull-requests: readis enough foramannn/action-semantic-pull-requestto read the title.deployment.yml:contents: readfor checkout,pull-requests: writefor the PR-URL comment job.lint.yml,safe-apps-check.yml:contents: read.safe-apps-e2e.yml:actions: writeforstyfle/cancel-workflow-action,contents: readfor checkout.