Repository navigation
security: build release drafts before immutable publish #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # MCH Release Integrity Policy (from v0.2.3) | ||
|
|
||
| - Repository setting **Enable release immutability** must be enabled **before** any release is published (verified 2026-10-22 through GitHub's `/immutable-releases` API). | ||
| - Release pipeline starts only on a new stable `vX.Y.Z` tag pushed from an ancestor of public `main`. Manual reruns targeting already published releases are deliberately unsupported. | ||
| - `verify` rejects pre-existing published releases, tags older than v0.2.3, malformed versions, tags not on `main`, and tags disagreeing with the package version. | ||
| - Five platform binaries and the two source archives are built with the exact Rust toolchain version **1.99.1** and pinned GitHub Actions versions. Android output is cross-compiled with Bionic and its dynamic linker explicitly inspected. | ||
| - A **draft** release is created only after every build job and archive validation passed. Seven archives and a SHA256SUMS are uploaded **without overwriting** prior assets. | ||
| - Exactly eight remote asset digests are rechecked before the draft is made public. GitHub's `immutable` property must be true after publication. | ||
| - Incomplete or failed draft builds are deliberately not automatically published. Manual inspection and a **new tag / patch release** are safer than overwriting immutable downloads. | ||
| - Old v0.2.2 and earlier artifacts remain mutable: repository immutability changes apply to future releases only. Never use this new workflow to re-upload their assets. | ||
| - Releasing code still requires explicit review, independent CI and actual target-platform testing; workflow safeguards do not substitute for review. | ||
|
|
||
| Do not create a published release manually before the tag-triggered pipeline completes: GitHub will immediately seal an immutable empty release, preventing attachments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env python3 | ||
| """Fail-closed source policy for the public release workflow.""" | ||
| from pathlib import Path | ||
| import re | ||
|
|
||
| root = Path(__file__).resolve().parents[1] | ||
| workflow = (root / ".github/workflows/release-packages.yml").read_text() | ||
| def check(cond, message): | ||
| if not cond: | ||
| raise SystemExit("RELEASE POLICY BLOCK: " + message) | ||
|
|
||
| check(" push:\n tags:" in workflow, "tag push must start release build") | ||
| check(" workflow_dispatch:" not in workflow, "manual rebuild trigger forbidden") | ||
| check("types: [published]" not in workflow, "published-release trigger too late") | ||
| check(bool(re.search(r'^\s+toolchain:\s*"?\d+\.\d+\.\d+"?\s*$', workflow, re.M)), "pin exact Rust version") | ||
| check("gh release create \"$TAG\"" in workflow and "--draft" in workflow, "draft before publish") | ||
| check("gh release upload \"$TAG\" dist/*" in workflow, "expected upload") | ||
| check(not re.search(r'^\s*gh release upload[^\n]*--clobber', workflow, re.M), "no clobber") | ||
| check('gh release edit "$TAG"' in workflow and "--draft=false" in workflow, "publish verified draft") | ||
| check('uploaded[name].get("digest")' in workflow, "verify remote SHA256 digests") | ||
| check('"isDraft,assets"' in workflow and '["gh", "release", "view"' in workflow, | ||
| "draft-aware asset inspection; REST by-tag omits drafts") | ||
| check("Remote tag moved after validation" in workflow and "Remote tag changed before publication" in workflow, | ||
| "compare peeled remote tag with pinned verified commit before draft and publish") | ||
| check('".immutable"' in workflow or ".immutable)" in workflow or "--jq .immutable" in workflow, "check immutable") | ||
| check("Already published; refusing replacement" in workflow, "refuse published tag") | ||
| check("Historical tag: refuse rebuild" in workflow, "no historical rebuilds") | ||
| check("Expected eight immutable release assets" in workflow, "final asset count") | ||
| print("PUBLIC_RELEASE_POLICY_PASS") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.