Skip to content

fix: add explicit permissions to all GitHub Actions workflows#693

Merged
Zee2413 merged 1 commit intoaws-cloudformation:mainfrom
Zee2413:fix/workflow-permissions
Mar 30, 2026
Merged

fix: add explicit permissions to all GitHub Actions workflows#693
Zee2413 merged 1 commit intoaws-cloudformation:mainfrom
Zee2413:fix/workflow-permissions

Conversation

@Zee2413
Copy link
Copy Markdown
Contributor

@Zee2413 Zee2413 commented Mar 30, 2026

Summary

Resolves all 24 open CodeQL code-scanning alerts for actions/missing-workflow-permissions.

Problem

Without an explicit permissions block, the GITHUB_TOKEN in each workflow gets the repository's default permissions, which is typically read/write on all scopes. This violates the principle of least privilege — if a compromised or malicious action runs in any of these workflows, it has more access than necessary.

Fix

Added a top-level permissions: { contents: read } block to each workflow file, restricting the token to the minimum required scope:

Workflow Permissions Added
action-ci.yml contents: read
pr.yml contents: read
pre-commit.yml contents: read
release.yml contents: read
security_audit.yml contents: read
typescript_library.yml contents: read

All workflows only need read access to check out code and run builds/tests. Jobs in release.yml that require elevated permissions (version-bump, github-release, publish-docker) already have explicit job-level permissions blocks that override the workflow-level default.

Alerts Resolved

24 medium-severity CodeQL alerts across 6 workflow files.

Add top-level permissions blocks to restrict GITHUB_TOKEN scope,
resolving 24 CodeQL code-scanning alerts (actions/missing-workflow-permissions).

Without explicit permissions, workflows get the repo's default token
permissions, which is typically overly broad. This follows the principle
of least privilege — if a compromised action runs, it only has the
minimum access needed.

- action-ci.yml: contents: read
- pr.yml: contents: read
- pre-commit.yml: contents: read
- release.yml: contents: read (jobs needing write already have explicit blocks)
- security_audit.yml: contents: read, security-events: write
- typescript_library.yml: contents: read
@Zee2413 Zee2413 force-pushed the fix/workflow-permissions branch from 50a0ce6 to 7c12be1 Compare March 30, 2026 18:10
@Zee2413 Zee2413 merged commit 776e4d2 into aws-cloudformation:main Mar 30, 2026
22 checks passed
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.

3 participants