Commit 1927b03
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_01Rg3UBFSnmKMPQLNpNKkn8d1 parent e8e2b9e commit 1927b03
2 files changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
| |||
0 commit comments