Skip to content

Commit af4c3a5

Browse files
authored
Add explicit GITHUB_TOKEN permissions to workflow files (#629)
## Summary - Adds `permissions: { contents: read }` to 7 workflow files missing explicit permission scoping - Follows principle of least privilege for GITHUB_TOKEN - Resolves code scanning alerts #15, #20, #21, #23, #24, #25, #26, #29, #33, #59, #60, #65, #69, #70, #71 ## Files changed - `testing-dependency-rest.yaml` - `testing-dependency-grpc.yaml` - `testing-dependency-asyncio.yaml` - `testing-dependency.yaml` - `cleanup-nightly.yaml` - `build-and-publish-docs.yaml` - `publish-to-pypi.yaml` ## Test plan - [x] Workflow-only change — adds permissions blocks, no logic changes - [ ] CI checks pass on this PR <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk workflow-only change that tightens default `GITHUB_TOKEN` access; main risk is an unexpected permissions mismatch causing workflow failures (notably PyPI publishing/tag pushes). > > **Overview** > Adds explicit `permissions` blocks to several GitHub Actions workflows to follow least-privilege defaults. > > Most workflows are scoped to `contents: read`, while the PyPI release workflow is explicitly granted `contents: write` to support tagging/pushing during releases. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 49b5bf2. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent f9ab85c commit af4c3a5

7 files changed

Lines changed: 21 additions & 0 deletions

.github/workflows/build-and-publish-docs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
SSH_DEPLOY_KEY:
88
required: true
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
build-and-deploy-documentation:
1215
runs-on: ubuntu-latest

.github/workflows/cleanup-nightly.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
schedule:
66
- cron: '5 22 * * *' # 5 minutes after 10pm UTC, every day
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
cleanup-all:
1013
name: Cleanup all indexes/collections

.github/workflows/publish-to-pypi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ on:
3434
type: string
3535
default: 'pypi' # options are: pypi, testpypi
3636

37+
permissions:
38+
contents: write
39+
3740
jobs:
3841
pypi:
3942
timeout-minutes: 30

.github/workflows/testing-dependency-asyncio.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
required: true
1111
type: string
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
dependency-matrix-asyncio-rest:
1518
name: Deps (Asyncio REST)

.github/workflows/testing-dependency-grpc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
required: true
1111
type: string
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
dependency-matrix-grpc:
1518
name: GRPC py3.10/py3.10

.github/workflows/testing-dependency-rest.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
required: true
1212
type: string
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
dependency-matrix-rest:
1619
name: Deps (REST)

.github/workflows/testing-dependency.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
required: true
88
type: string
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
deps-test-setup:
1215
name: Deps setup

0 commit comments

Comments
 (0)