Skip to content

Commit ae3203a

Browse files
Copilotademidoff
andauthored
Fix GitHub workflow token permissions for security compliance (#4992)
* Initial plan * Fix GitHub workflow token permissions for code scanning compliance - Add top-level `permissions: contents: read` to 6 workflows (api.yml, documentation.yml, linkspector.yml, main.yml, sbom.yml, ui.yml) - Fix dependabot.yml: move write permissions from top-level to job-level - Add job-level `contents: write` permission to documentation.yml for git push operations All workflows now follow best practices: - Top-level permissions set as read-all or contents: read - Write permissions only at job-level where needed - No permissions: write-all at job level Co-authored-by: ademidoff <81549+ademidoff@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ademidoff <81549+ademidoff@users.noreply.github.com>
1 parent 23ed01d commit ae3203a

File tree

7 files changed

+24
-2
lines changed

7 files changed

+24
-2
lines changed

.github/workflows/api.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010

1111
workflow_dispatch:
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
sync:
1518
name: Sync API Docs

.github/workflows/dependabot.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ name: Dependabot
22
on: pull_request
33

44
permissions:
5-
contents: write
6-
pull-requests: write
5+
contents: read
76

87
jobs:
98
dependabot:
109
name: Enable auto-merge
1110
runs-on: ubuntu-22.04
1211
if: ${{ github.actor == 'dependabot[bot]' }}
12+
permissions:
13+
contents: write
14+
pull-requests: write
1315
steps:
1416
- name: Dependabot metadata
1517
id: metadata

.github/workflows/documentation.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ on:
99

1010
workflow_dispatch:
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
build:
1417
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write # for git push operations
1520

1621
steps:
1722
- name: Check out code

.github/workflows/linkspector.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
paths:
55
- "documentation/**"
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
check-links:
912
name: linkspector

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111

1212
pull_request:
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
check:
1619
name: Checks

.github/workflows/sbom.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- v[0-9]+.[0-9]+.[0-9]+*
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
sbom:
1013
runs-on: ubuntu-22.04

.github/workflows/ui.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ on:
2424
- "vmproxy/**"
2525
- "update/**"
2626

27+
permissions:
28+
contents: read
29+
2730
jobs:
2831
ci:
2932
name: CI

0 commit comments

Comments
 (0)