Skip to content

Commit 61be878

Browse files
Scope GitHub App tokens to repo and minimum permissions
Each token-minting step now requests only the permissions the job actually exercises and restricts the token to the current repository. Plan: repositories: current repo permission-contents: read (gh release list in Resolve-Version) permission-pull-requests: write (label/comment via Get-PSModuleSettings) Publish-Module: repositories: current repo permission-contents: write (gh release create/upload/delete) permission-pull-requests: write (gh pr comment) Build-Module: repositories: current repo (no permission-* needed - only gh repo view which uses metadata:read, auto-granted to all GitHub App installations) This limits blast radius: even if a compromised step obtained GH_TOKEN, it could only act on the one repository and only with the declared permission level, not on every repo in the installation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 3b4410a commit 61be878

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/Build-Module.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
with:
4949
app-id: ${{ secrets.GitHubAppClientId }}
5050
private-key: ${{ secrets.GitHubAppPrivateKey }}
51+
repositories: ${{ github.event.repository.name }}
5152

5253
- name: Build module
5354
uses: ./_wf/.github/actions/Build-PSModule

.github/workflows/Plan.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ jobs:
9393
with:
9494
app-id: ${{ secrets.GitHubAppClientId }}
9595
private-key: ${{ secrets.GitHubAppPrivateKey }}
96+
repositories: ${{ github.event.repository.name }}
97+
permission-contents: read
98+
permission-pull-requests: write
9699

97100
- name: Get-Settings
98101
uses: ./_wf/.github/actions/Get-PSModuleSettings

.github/workflows/Publish-Module.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
with:
5050
app-id: ${{ secrets.GitHubAppClientId }}
5151
private-key: ${{ secrets.GitHubAppPrivateKey }}
52+
repositories: ${{ github.event.repository.name }}
53+
permission-contents: write
54+
permission-pull-requests: write
5255

5356
- name: Publish module
5457
if: fromJson(inputs.Settings).Publish.Module.Resolution.ReleaseType != 'None'

0 commit comments

Comments
 (0)