Skip to content

Harden the publishing jobs: tag-only environment, no stored tokens, no third-party release action - #72

Merged
ivankovic merged 1 commit into
mainfrom
ci-harden-publishing
Nov 11, 2026
Merged

ivankovic merged 1 commit into
mainfrom
ci-harden-publishing

Conversation

@ivankovic

Copy link
Copy Markdown
Owner

Items 2–4 of the workflow security check (item 1 is #71).

In this PR

  • apt and dnf deploy to the new release environment (only v* tags may deploy), so the signing key can live there instead of as a repository secret.
  • persist-credentials: false on all 15 checkouts.
  • The two gh-pages pushes take the token from GH_TOKEN through a credential helper instead of embedding it in the URL.
  • softprops/action-gh-release replaced with gh release create (or edit + upload --clobber on a re-run), so the job holding contents: write over the release runs no third-party code.
  • RELEASING.md updated.

Already applied to the repository with gh api

  • Environment release, deployment policy: tags v*.
  • Ruleset release tags: creating, moving or deleting v* tags restricted to admins (you bypass).
  • Actions: only GitHub-owned actions plus dtolnay/rust-toolchain, Swatinem/rust-cache, taiki-e/install-action, and softprops/action-gh-release (to remove once this merges); SHA pinning required.

Still to do: the key isn't on this machine, so APT_GPG_PRIVATE_KEY is still a repository secret. It works with this PR as is (repository secrets reach environment jobs too); moving it is one command from the machine holding the key backup.

The publishing jobs only run on a tag, so CI here exercises the checkout change, not the release path.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FNs394W7GMp53qrHNPrACN

- apt and dnf deploy to the `release` environment, which only `v*` tags
  can deploy to, so its secret is out of reach of a workflow on a branch
- every checkout sets persist-credentials: false
- the gh-pages pushes take the token from the environment through a
  credential helper, not in the URL on git's command line
- the release is created with gh rather than a third-party action, so no
  code from outside GitHub runs in the job that writes it
- RELEASING.md: the environment, the tag ruleset and the allowed actions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FNs394W7GMp53qrHNPrACN
@ivankovic
ivankovic merged commit 667ff8f into main Nov 11, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant