Skip to content

Commit 7c12be1

Browse files
committed
fix: add explicit permissions to all GitHub Actions workflows
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
1 parent 82c5afc commit 7c12be1

6 files changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/action-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
paths:
99
- "action/**"
1010
- "action.yml"
11+
permissions:
12+
contents: read
1113
jobs:
1214
run-unit-tests:
1315
runs-on: ubuntu-latest

.github/workflows/pr.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ on:
1313
env:
1414
CARGO_TERM_COLOR: always
1515
FUZZ_TIME: 420
16-
16+
permissions:
17+
contents: read
1718
jobs:
1819
build:
1920
name: Build all crates & run unit tests

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
- .github/workflows/pre-commit.yml
1515
- .pre-commit-config.yaml
1616
- .pre-commit-hooks.yaml
17+
permissions:
18+
contents: read
1719
jobs:
1820
run-unit-tests-and-lint:
1921
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ on:
1919
default: false
2020
env:
2121
CARGO_TERM_COLOR: always
22-
22+
permissions:
23+
contents: read
2324
jobs:
2425
# ---------------------------------------------------------------------------
2526
# 1. Validate input & run tests

.github/workflows/security_audit.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Security audit
22
on:
33
schedule:
44
- cron: "0 17 * * *"
5-
5+
permissions:
6+
contents: read
67
jobs:
78
audit:
89
if: github.repository == 'aws-cloudformation/cloudformation-guard'

.github/workflows/typescript_library.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
pull_request:
77
paths:
88
- 'guard/ts-lib/**'
9+
permissions:
10+
contents: read
911
jobs:
1012
run-unit-tests-windows:
1113
runs-on: windows-latest

0 commit comments

Comments
 (0)