Skip to content

Commit 2cdc03e

Browse files
feat: scope CI workflow permissions to least privilege
Move permissions to job level; review mode drops contents:write -> read (it never pushes the baseline back to the PR branch - that is sync mode only, see action.yml `mode` input). Keeps uses: ./ dogfooding and the CodeBoarding App-token identity intact. Rebuilt PR #50 onto current main to resolve the no-common-ancestor conflicts left by main's history rewrite. This feat: also carries the already-merged codeboarding 0.12.5 engine bump (#49) into the next release, which release-please missed because #49's squash title lacked a Conventional Commit prefix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 40c4564 commit 2cdc03e

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

‎.github/workflows/codeboarding-sync.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ on:
3232
required: false
3333
default: false
3434

35-
permissions:
36-
contents: write # commit the generated baseline + docs to main
35+
# No workflow-level permissions: the single job below requests only what it
36+
# needs (least privilege), so the default token starts with none.
37+
permissions: {}
3738

3839
concurrency:
3940
# Serialize this workflow against itself: a push landing while a manual
@@ -45,6 +46,8 @@ jobs:
4546
sync:
4647
runs-on: ubuntu-latest
4748
timeout-minutes: 60
49+
permissions:
50+
contents: write # commit the generated baseline + docs to main
4851
steps:
4952
# Dogfood: run the action from the checked-out repo (uses: ./) so pushes to
5053
# main exercise the action code on main, not the last published release.

‎.github/workflows/codeboarding.yml‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ on:
1010
issue_comment:
1111
types: [created]
1212

13-
permissions:
14-
# write: the action commits the generated .codeboarding/analysis.json back to the
15-
# PR branch so the webview can open this PR's diff at the head SHA (same-repo PRs).
16-
contents: write
17-
pull-requests: write
18-
issues: write
13+
# No workflow-level permissions: the single job below requests only what it
14+
# needs (least privilege), so the default token starts with none.
15+
permissions: {}
1916

2017
concurrency:
2118
group: codeboarding-${{ github.event.pull_request.number || github.event.issue.number }}
@@ -27,6 +24,13 @@ jobs:
2724
review:
2825
runs-on: ubuntu-latest
2926
timeout-minutes: 60
27+
permissions:
28+
# Review mode reads the repo + committed baseline and posts a PR comment;
29+
# it does NOT commit generated files back to the branch (that is sync mode
30+
# only — see action.yml `mode` input). So contents stays read-only.
31+
contents: read
32+
pull-requests: write # post / update the architecture-diff PR comment
33+
issues: write # the /codeboarding issue_comment trigger + comment API
3034
if: >
3135
(github.event_name == 'pull_request' && github.event.action != 'closed' && github.event.pull_request.draft == false) ||
3236
(github.event_name == 'issue_comment' && github.event.issue.pull_request != null &&

0 commit comments

Comments
 (0)