cimas-master: add least-privilege permissions: to 6 caller templates - #339
Conversation
The cimas `master` caller templates that sync to downstream standalone gem repos lacked a `permissions:` block, so every synced repo inherited the over-broad default GITHUB_TOKEN and got flagged by CodeQL `actions/missing-workflow-permissions`. Add an explicit least-privilege top-level `permissions:` ceiling to each, sized to what the called reusable workflow actually needs (the caller's top-level permission caps the reusable's GITHUB_TOKEN): - release.yml / release_wo_bundle_install.yml -> contents:write + id-token:write (rubygems-release.yml: git tag push + OIDC Trusted Publishing) - release_github_packages.yml -> contents:write + packages:write (ghpkg-release.yml: tag push via GITHUB_TOKEN; gem push uses pat_token) - notify.yml -> contents:read (mn-processor-notify.yml: dispatch via pat_token) - rake-flavor.yml -> contents:read (mn-processor-rake.yml tops at read) - automerge.yml -> contents:write + pull-requests:write (pascalgn/automerge-action) master/rake.yml already carried contents:write and is unchanged. Also fixes a pre-existing missing EOF newline in release_github_packages.yml. Note: the originating hand-off (metanorma/pubid) assumed these clear pubid's alerts on re-sync, but pubid is currently PENDING-READD (not cimas-synced, gated on #300 Gap 2), so pubid's own alerts are addressed separately by hardening its local workflows directly.
1e884f4 to
eadff8b
Compare
|
Ack — this is well-scoped and reads cleanly. Deliberately keeping it out of the wave I'm firing tonight (which carries a 🤖 |
|
@ronaldtse — flagging that this is now blocking the CodeQL missing- Your approval on this PR unblocks the fix — the six template 🤖 |
…ded on main Wave PRs from 2026-07-08 taken to closure: 78 admin-merged (58 sync + 20 cleanup), 3 DIRTY closed (re-emit next wave), 1 wrong-org retried. 93 branches cleaned across origin + local checkouts via cleanup-merged-prs. metanorma/ci#339 (Andrew's least-privilege permissions on 6 master caller templates) and #348 (class F Ruby-floor drift audit) both merged on main — distribute / activate on next cadence. Mass-fail mn-templates-* PRs merged despite red CI: attributable to the 2026-07-09 lutaml/xmi gem-yank fallout, not to wave content.
What
Adds an explicit least-privilege top-level
permissions:block to the six cimas master caller templates (cimas-config/gh-actions/master/) that previously had none. These templates sync to downstream standalone gem repos, so a missingpermissions:meant each synced repo inherited the over-broad defaultGITHUB_TOKENand got flagged by CodeQLactions/missing-workflow-permissions.Each ceiling is sized to what the called reusable workflow actually needs (the caller's top-level
permissions:caps the reusable'sGITHUB_TOKEN):release.yml,release_wo_bundle_install.ymlcontents: write+id-token: writerubygems-release.ymlrelease job: git tag push + OIDC Trusted Publishingrelease_github_packages.ymlcontents: write+packages: writeghpkg-release.yml: tag push via GITHUB_TOKEN;gem pushusespat_tokennotify.ymlcontents: readmn-processor-notify.yml: dispatch viapat_tokenonlyrake-flavor.ymlcontents: readmn-processor-rake.ymlalready tops atcontents: readautomerge.ymlcontents: write+pull-requests: writepascalgn/automerge-actionmerges PRs via GITHUB_TOKENmaster/rake.ymlalready carriedcontents: writeand is unchanged. Also fixes a pre-existing missing-EOF-newline inrelease_github_packages.yml.Context / scope note
This originated from a
metanorma/pubidhand-off asking to fix the "source templates" behind pubid'sgeneric-rake.yml/rubygems-release.yml. During investigation:metanorma/ci's own reusablegeneric-rake.ymlandrubygems-release.ymlalready carry least-privilege permissions — no change needed there.cimas.ymllists itPENDING-READD, gated on cimas revival: design gaps and mandatory drift-audit before each sync #300 Gap 2), and its workflows are pubid-local + diverged — so nometanorma/cichange reaches pubid today.pubid's own 5 alerts are addressed separately by hardening pubid's local workflows directly (safe while sync is paused) — tracked out-of-band, not part of this PR.
Validation
Repo CI is
yamllint+actionlint+shellcheck(no rspec). Locally verified: all 6 files parse as valid YAML with the intended scopes; no trailing whitespace, lines ≤140, files end with a newline; only the 6 templates changed. yamllint/actionlint run in CI on push.