Skip to content

Commit f58e9eb

Browse files
nullvariantclaude
andauthored
security: minimize GitHub Actions permissions (#91)
Apply least-privilege principle to all 12 workflow files: - Set workflow-level permissions to {} (no default permissions) - Add explicit job-level permissions for each job - Ensure only contents:read for most jobs - Maintain necessary write permissions for publish/security workflows This change follows the zero-trust security model by: 1. Removing overly permissive read-all at workflow level 2. Granting minimum required permissions per job 3. Preventing accidental privilege escalation for new jobs 🖥️ IDE: [Cursor](https://cursor.sh) 🔌 Extension: [Claude Code](https://claude.ai/download) Model-Raw: claude-opus-4-5-20251101 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a23a577 commit f58e9eb

12 files changed

Lines changed: 41 additions & 12 deletions

.github/workflows/blaze-bot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
name: 🐗 Blaze Bot
55

6-
permissions: read-all
6+
permissions: {}
77

88
on:
99
workflow_dispatch:
@@ -17,6 +17,8 @@ jobs:
1717
blaze-commit:
1818
name: 🐗 Charge forward!
1919
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
2022

2123
steps:
2224
- name: 🐗 Get fired up!

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ on:
88
branches:
99
- main
1010

11-
permissions: read-all
11+
permissions: {}
1212

1313
jobs:
1414
build:
1515
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
1618

1719
steps:
1820
- name: Checkout
@@ -59,6 +61,8 @@ jobs:
5961
e2e:
6062
name: E2E Tests (VS Code Extension)
6163
runs-on: ubuntu-latest
64+
permissions:
65+
contents: read
6266
continue-on-error: true
6367

6468
steps:

.github/workflows/ciel-bot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
name: 🕊️ Ciel Bot
55

6-
permissions: read-all
6+
permissions: {}
77

88
on:
99
workflow_dispatch:
@@ -17,6 +17,8 @@ jobs:
1717
ciel-commit:
1818
name: 🕊️ Descend from the sky
1919
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
2022

2123
steps:
2224
- name: 🕊️ Arrive gracefully

.github/workflows/deploy-docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ on:
1414
- 'extensions/git-id-switcher/docs/**' # All language READMEs + docs
1515
workflow_dispatch: # Manual trigger
1616

17-
permissions: read-all
17+
permissions: {}
1818

1919
jobs:
2020
deploy:
2121
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
2224
# Prevent forks from deploying (no Cloudflare secrets)
2325
if: github.repository == 'nullvariant/nullvariant-vscode-extensions'
2426

.github/workflows/generate-readme.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- 'extensions/git-id-switcher/README.md'
88
workflow_dispatch: # Manual trigger for verification
99

10-
permissions: read-all
10+
permissions: {}
1111

1212
# README auto-generation is handled by local pre-commit hook (husky)
1313
# This workflow only verifies sync as a safety net
@@ -16,6 +16,8 @@ jobs:
1616
check-sync:
1717
name: Verify README is in sync
1818
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
1921

2022
steps:
2123
- name: Checkout

.github/workflows/justice-bot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
name: 👮 Justice Bot
55

6-
permissions: read-all
6+
permissions: {}
77

88
on:
99
workflow_dispatch:
@@ -17,6 +17,8 @@ jobs:
1717
justice-commit:
1818
name: 👮 Enforce the law
1919
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
2022

2123
steps:
2224
- name: 👮 Begin inspection

.github/workflows/luna-bot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
name: 👧 Luna Bot
55

6-
permissions: read-all
6+
permissions: {}
77

88
on:
99
workflow_dispatch:
@@ -17,6 +17,8 @@ jobs:
1717
luna-commit:
1818
name: 👧 Explore and discover
1919
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
2022

2123
steps:
2224
- name: 👧 Start exploring

.github/workflows/mimi-bot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
name: 🐰 Mimi Bot
55

6-
permissions: read-all
6+
permissions: {}
77

88
on:
99
workflow_dispatch:
@@ -17,6 +17,8 @@ jobs:
1717
mimi-commit:
1818
name: 🐰 Listen carefully
1919
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
2022

2123
steps:
2224
- name: 🐰 Perk up ears

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
tags:
66
- 'git-id-switcher-v*'
77

8-
permissions: read-all
8+
permissions: {}
99

1010
jobs:
1111
publish:

.github/workflows/security.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ on:
1414
branch_protection_rule:
1515
workflow_dispatch:
1616

17-
permissions: read-all
17+
permissions: {}
1818

1919
jobs:
2020
security-audit:
2121
name: Security Audit
2222
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
2325
defaults:
2426
run:
2527
working-directory: extensions/git-id-switcher
@@ -48,6 +50,8 @@ jobs:
4850
lint-security:
4951
name: Security Linting
5052
runs-on: ubuntu-latest
53+
permissions:
54+
contents: read
5155
defaults:
5256
run:
5357
working-directory: extensions/git-id-switcher
@@ -88,6 +92,8 @@ jobs:
8892
security-tests:
8993
name: Security Tests
9094
runs-on: ubuntu-latest
95+
permissions:
96+
contents: read
9197
defaults:
9298
run:
9399
working-directory: extensions/git-id-switcher
@@ -146,6 +152,7 @@ jobs:
146152
# Only run on main branch (push, schedule) - not on PRs
147153
if: github.event_name != 'pull_request'
148154
permissions:
155+
contents: read
149156
security-events: write
150157
id-token: write
151158

0 commit comments

Comments
 (0)