Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Gate release signing behind a reviewed environment and commits on main - #916

Draft
FuJacob wants to merge 1 commit into
mainfrom
security/release-gating
Draft

FuJacob wants to merge 1 commit into
mainfrom
security/release-gating

Conversation

@FuJacob

@FuJacob FuJacob commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Summary

The Release workflow signs, notarizes and publishes to the auto-update feed for any pushed v* tag and any manual dispatch from any branch, and every signing secret is a repo-level secret that any workflow on any branch can read. This moves the signing work behind a protected release environment and refuses to sign anything that is not already on main.

  • New guard job (ubuntu, no secrets) runs first. It fails unless a manual dispatch comes from refs/heads/main and git merge-base --is-ancestor "$GITHUB_SHA" origin/main holds (checkout uses fetch-depth: 0). Because it runs before any environment job, a bad ref fails before anyone is asked to approve. It guards against mistakes only: a tag at an unreviewed commit runs that commit's copy of the workflow. The environment and tag ruleset below are the actual boundary.
  • build and notarize now run in environment: release.
  • Appcast signing (Sparkle tools, Sparkle key, generate_appcast.py, signature check) moves from publish into notarize, gated on publish == 'true'. It hands the signed appcast to publish as a cotabby-appcast artifact. Why: publish has to stay in github-pages for deploy-pages, and a job has only one environment. Without the move, the Sparkle key would sit in an environment with no reviewers, or need a third approval per release. notarize already holds the final stapled DMG the signature covers. publish now reads no signing secret, only GITHUB_TOKEN.
  • gh release create passes --target "$GITHUB_SHA", so a tag created by a dispatch run points at the built commit, not at whatever main is when publish runs.
  • RELEASING.md describes the new gate.

Validation

  • actionlint .github/workflows/release.yml: no new findings. The only two reported are the shellcheck notes already on main (SC2129 in the metadata step, SC2046 in the certificate import step), which this PR doesn't touch.
  • I read through every step that moved to confirm it still finds its inputs: SPARKLE_KEY_FILE via GITHUB_ENV, steps.sparkle-tools, and needs.build.outputs.* from notarize. release-artifacts still contains appcast.xml, so republish-pages.yml keeps working.
  • Not built or run locally (no disk space on the authoring machine); CI build and tests are the compile check. Release workflow changes are not exercised by PR CI, so please do a publish: false dispatch from main after merging. A dry run skips the appcast steps, so the moved signing steps first run on the next real publish.

Linked issues

None filed. Addresses H1 from a static security review of 8cdbea2.

Risk / rollout notes

Merging first does not break releases. Until a release environment exists, GitHub creates it unprotected the first time a job references it, and repo-level secrets keep resolving. The protection only takes effect once these settings are applied:

  1. Create the release environment (Settings → Environments → New environment → release):
    • Required reviewers: yourself and any co-maintainers. If you are the only reviewer, leave "Prevent self-review" off.
    • Deployment branches and tags: "Selected branches and tags", with branch main and tag v*.
  2. Add these as release environment secrets, using the same values: DEVELOPER_ID_APPLICATION_CERT, DEVELOPER_ID_CERT_PASSWORD, APPLE_TEAM_ID, APPLE_ID, APPLE_APP_SPECIFIC_PASSWORD, SPARKLE_ED25519_PRIVATE_KEY.
  3. Run a publish: false dispatch from main to confirm build and notarize pick up the environment secrets.
  4. Delete the repo-level copies of those six secrets (Settings → Secrets and variables → Actions → Repository secrets). Until you do, a workflow pushed on any branch can still read them, because environment secrets only add protection; they don't hide repo-level ones.
  5. Add a tag ruleset: target tags matching v*, enable "Restrict creations", "Restrict updates" and "Restrict deletions", and put only the maintainer/admin role on the bypass list. Without it, anyone with write access can create a v* tag, and that tag satisfies the environment's v* deployment rule.

Behavior changes:

  • Each release waits for two approvals, one when build starts and one when notarize starts. Dry runs also need both.
  • Manual runs from any branch other than main, and tags on commits not on main, now fail in guard.
  • If appcast signing fails, re-running notarize also re-submits notarization. Before, only the cheap publish job re-ran.

Follow-ups, not done here:

  • HOMEBREW_TAP_TOKEN (used by update-homebrew-cask) is still repo-level. It can rewrite the tap's cask, so consider moving it into an environment too.
  • The build job still reads SPARKLE_ED25519_PRIVATE_KEY for its public-key match check. A separate PR removes it from the build job.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
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