Skip to content

Commit 83dc1ca

Browse files
ci: Add explicit permissions to the sync workflows (#43)
`sync-upstream-rebase.yml` and `sync-promote-branch.yml` are the only two workflows unique to this repo — every other workflow arrives via sync from `paradedb/paradedb`, so this is the one place the hardening has to be applied directly. Both call reusable workflows in `paradedb/actions@v8`, which declare job-level permissions: | Reusable workflow | Declares | |---|---| | `reusable-rebase.yml` | `actions: write`, `checks: read`, `contents: write`, `issues: write`, `pull-requests: read` | | `reusable-promote.yml` | `actions: write`, `contents: write`, `issues: write`, `pull-requests: read` | **A called workflow's permissions are capped by the calling job's token.** The calling jobs here declare nothing, so today they inherit the repository default (write) and the reusable workflows get what they ask for. If the org default is switched to read-only — which grants only `contents: read` and `packages: read` — the callers would silently cap the reusable workflows below what they need, and both sync workflows would break: - `sync-core.sh` reads check runs via `gh api .../check-runs` — needs `checks: read` - `sync-core.sh` restarts failed jobs via `gh api -X POST .../actions/jobs/{id}/rerun` — needs `actions: write` - `reusable-promote.yml` uses `trstringer/manual-approval` with `github.token`, which opens an approval issue — needs `issues: write` This mirrors each reusable workflow's declared permissions onto its caller so the flip is safe. Note `sync-upstream-rebase.yml` runs on a schedule, so a regression here would surface as a silent failure rather than a red PR. https://claude.ai/code/session_01Rg3UBFSnmKMPQLNpNKkn8d
1 parent 56022bb commit 83dc1ca

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

.github/workflows/sync-promote-branch.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ concurrency:
1717
group: promote-branch
1818
cancel-in-progress: false
1919

20+
permissions:
21+
actions: write
22+
contents: write
23+
issues: write
24+
pull-requests: read
25+
2026
jobs:
2127
call-promote:
2228
uses: paradedb/actions/.github/workflows/reusable-promote.yml@v8

.github/workflows/sync-upstream-rebase.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ concurrency:
1515
group: upstream-rebase
1616
cancel-in-progress: false
1717

18+
permissions:
19+
actions: write
20+
checks: read
21+
contents: write
22+
issues: write
23+
pull-requests: read
24+
1825
jobs:
1926
call-rebase:
2027
uses: paradedb/actions/.github/workflows/reusable-rebase.yml@v8

0 commit comments

Comments
 (0)