Skip to content

Commit 7cbc3d7

Browse files
authored
Merge pull request #115 from anoncam/copilot/implement-immutable-releases
Implement build provenance attestations before release creation
2 parents 62c3152 + a51fc51 commit 7cbc3d7

3 files changed

Lines changed: 225 additions & 2 deletions

File tree

‎.github/workflows/release-with-sbom.yml‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ name: Release with SBOM and Notes
77
permissions:
88
contents: write # Needed for creating releases and tags
99
actions: read # Needed to read workflow runs
10-
id-token: write # Needed for npm provenance
10+
id-token: write # Needed for npm provenance and build attestations
11+
attestations: write # Needed for build provenance attestations
1112

1213
on:
1314
# Allow manual triggering for specific versions
@@ -399,6 +400,20 @@ jobs:
399400
echo "### SBOM Information" >> RELEASE_NOTES.md
400401
echo "This release includes a Software Bill of Materials (SBOM) in CycloneDX format." >> RELEASE_NOTES.md
401402
echo "" >> RELEASE_NOTES.md
403+
echo "### 🔐 Verified Release" >> RELEASE_NOTES.md
404+
echo "This release includes cryptographic build provenance attestations and is immutable (artifacts and tags cannot be modified or deleted). Release immutability is enabled in this repository." >> RELEASE_NOTES.md
405+
echo "" >> RELEASE_NOTES.md
406+
echo "**Verify this release:**" >> RELEASE_NOTES.md
407+
echo '```bash' >> RELEASE_NOTES.md
408+
echo "# Verify SBOM" >> RELEASE_NOTES.md
409+
echo "gh attestation verify bom.json --owner anoncam --repo dedpaste" >> RELEASE_NOTES.md
410+
echo "" >> RELEASE_NOTES.md
411+
echo "# Verify build artifacts" >> RELEASE_NOTES.md
412+
echo "gh attestation verify <artifact-path> --owner anoncam --repo dedpaste" >> RELEASE_NOTES.md
413+
echo '```' >> RELEASE_NOTES.md
414+
echo "" >> RELEASE_NOTES.md
415+
echo "This ensures the artifacts have not been tampered with and were built by the official GitHub Actions workflow." >> RELEASE_NOTES.md
416+
echo "" >> RELEASE_NOTES.md
402417
403418
# Escape special characters for GitHub Actions output
404419
NOTES=$(cat RELEASE_NOTES.md)
@@ -420,7 +435,8 @@ jobs:
420435
runs-on: ubuntu-latest
421436
permissions:
422437
contents: write # Needed for creating releases
423-
id-token: write # Needed for npm provenance
438+
id-token: write # Needed for npm provenance and build attestations
439+
attestations: write # Needed for build provenance attestations
424440
steps:
425441
- name: Checkout code
426442
uses: actions/checkout@v4
@@ -490,6 +506,16 @@ jobs:
490506
node-version: '24'
491507
registry-url: 'https://registry.npmjs.org'
492508

509+
- name: Attest build provenance for SBOM
510+
uses: actions/attest-build-provenance@v2
511+
with:
512+
subject-path: ./bom.json
513+
514+
- name: Attest build provenance for build artifacts
515+
uses: actions/attest-build-provenance@v2
516+
with:
517+
subject-path: 'dist/*'
518+
493519
- name: Create GitHub Release
494520
id: create_release
495521
uses: softprops/action-gh-release@v2

‎README.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,29 @@ Each release includes:
382382
- Comprehensive Software Bill of Materials (SBOM)
383383
- Detailed release notes
384384
- NPM package with provenance
385+
- **Cryptographic attestations** for supply chain security with immutable releases
386+
387+
### 🔐 Verifying Releases
388+
389+
All releases include signed build provenance attestations and are immutable (preventing modification or deletion of artifacts and tags). Release immutability is enabled in this repository's settings.
390+
391+
You can verify the authenticity and integrity of releases using the GitHub CLI:
392+
393+
```bash
394+
# Install GitHub CLI if you haven't already
395+
# See: https://cli.github.com/
396+
397+
# Verify a release artifact
398+
gh attestation verify <artifact-path> --owner anoncam --repo dedpaste
399+
400+
# Example: Verify the SBOM
401+
gh attestation verify bom.json --owner anoncam --repo dedpaste
402+
```
403+
404+
This ensures that:
405+
- Release artifacts have not been tampered with
406+
- Artifacts were built by the official GitHub Actions workflow
407+
- The build is traceable to specific commits and workflows
385408

386409
View all releases: [GitHub Releases](https://github.com/anoncam/dedpaste/releases)
387410

‎docs/RELEASE-PROCESS.md‎

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# Release Process
2+
3+
This document describes the release process for DedPaste, including our implementation of GitHub's Immutable Releases feature for enhanced supply chain security.
4+
5+
## Overview
6+
7+
DedPaste uses an automated release workflow that creates immutable, cryptographically attested releases. This ensures that all release artifacts are tamper-proof and verifiable.
8+
9+
## Automated Release Workflow
10+
11+
### Version Bumping
12+
13+
When a pull request is merged to the `main` branch:
14+
15+
1. **Auto Version Bump** workflow analyzes the PR:
16+
- Checks PR labels (`major`, `minor`, `patch`)
17+
- Analyzes commit messages for conventional commit patterns
18+
- Determines the appropriate version bump
19+
20+
2. Conventional commit patterns:
21+
- `feat:` or `feat(scope):` → Minor version bump
22+
- `fix:` or `fix(scope):` → Patch version bump
23+
- `BREAKING CHANGE:` or `feat!:` → Major version bump
24+
25+
3. Updates `package.json` with the new version
26+
4. Triggers the release workflow
27+
28+
### Release Creation
29+
30+
The **Release with SBOM and Notes** workflow:
31+
32+
1. **Builds the project**
33+
- Compiles TypeScript files
34+
- Runs tests
35+
- Generates build artifacts
36+
37+
2. **Generates SBOM**
38+
- Creates a Software Bill of Materials (SBOM) in CycloneDX format
39+
- Documents all dependencies and their versions
40+
41+
3. **Creates release notes**
42+
- Lists all commits since the last release
43+
- Links to relevant pull requests
44+
- Includes SBOM information
45+
- Adds verification instructions
46+
47+
4. **Publishes the release**
48+
- Creates a GitHub release with the tag `vX.Y.Z`
49+
- Attaches the SBOM file
50+
- Includes detailed release notes
51+
52+
5. **Generates build provenance attestations** 🔐
53+
- Creates cryptographic attestations for all release artifacts
54+
- Signs attestations using GitHub's Sigstore integration
55+
- Ensures artifacts are immutable and verifiable
56+
57+
6. **Publishes to NPM**
58+
- Publishes the package with provenance
59+
- Uses OIDC Trusted Publishers for secure authentication
60+
61+
## Immutable Releases 🔐
62+
63+
### What are Immutable Releases?
64+
65+
Immutable releases are a security feature that makes release artifacts tamper-proof:
66+
67+
- **Immutable assets**: Once published, release artifacts cannot be modified, added, or deleted
68+
- **Protected tags**: Git tags are locked to specific commits and cannot be moved
69+
- **Cryptographic attestations**: Each release includes signed build provenance attestations
70+
- **Verifiable provenance**: Anyone can verify that artifacts were built by the official workflow
71+
72+
### How We Implement It
73+
74+
Our release workflow automatically:
75+
76+
1. **Generates build provenance attestations** for:
77+
- SBOM file (`bom.json`)
78+
- Build artifacts (`dist/*`)
79+
80+
2. **Signs attestations** using GitHub's Sigstore integration
81+
- Uses the GitHub Actions OIDC token
82+
- Creates tamper-evident signatures
83+
- Links artifacts to specific workflow runs and commits
84+
85+
3. **Publishes releases with attestations**
86+
- Release immutability is enabled in this repository (Settings → Code and automation → Releases)
87+
- All releases are immutable: artifacts cannot be modified after publication
88+
- Tags cannot be moved or deleted
89+
90+
### Verifying Releases
91+
92+
Anyone can verify the authenticity and integrity of our releases using the GitHub CLI:
93+
94+
```bash
95+
# Install GitHub CLI if needed
96+
# See: https://cli.github.com/
97+
98+
# Verify the SBOM file
99+
gh attestation verify bom.json --owner anoncam --repo dedpaste
100+
101+
# Verify build artifacts
102+
gh attestation verify <artifact-path> --owner anoncam --repo dedpaste
103+
104+
# Download and verify a release artifact
105+
gh release download v1.24.0 --pattern "bom.json" --repo anoncam/dedpaste
106+
gh attestation verify bom.json --owner anoncam --repo dedpaste
107+
```
108+
109+
Verification confirms:
110+
- ✅ Artifact was built by the official GitHub Actions workflow
111+
- ✅ Artifact has not been tampered with since publication
112+
- ✅ Artifact is linked to specific commits and workflow runs
113+
- ✅ Build process is traceable and transparent
114+
115+
### Benefits
116+
117+
1. **Supply Chain Security**
118+
- Prevents tampering with release artifacts
119+
- Protects against malicious code injection
120+
- Ensures artifacts match the source code
121+
122+
2. **Transparency**
123+
- Complete build provenance tracking
124+
- Verifiable connection between code and artifacts
125+
- Audit trail for all releases
126+
127+
3. **Trust**
128+
- Users can verify authenticity of downloads
129+
- Cryptographic proof of origin
130+
- Compliance with security best practices
131+
132+
## Manual Release Process
133+
134+
If needed, maintainers can trigger a release manually:
135+
136+
1. Go to the [Actions tab](https://github.com/anoncam/dedpaste/actions)
137+
2. Select "Release with SBOM and Notes" workflow
138+
3. Click "Run workflow"
139+
4. Optionally specify a version to force release
140+
141+
## Troubleshooting
142+
143+
### Release Already Exists
144+
145+
If a release already exists for a version, the workflow will skip creating a duplicate. Check:
146+
- Existing releases: https://github.com/anoncam/dedpaste/releases
147+
- Workflow logs in the Actions tab
148+
149+
### Build Attestation Failures
150+
151+
If attestation generation fails:
152+
- Check that `id-token: write` and `attestations: write` permissions are set
153+
- Verify the workflow is running on a public repository
154+
- Check GitHub Actions logs for detailed error messages
155+
156+
### NPM Publish Failures
157+
158+
If NPM publishing fails:
159+
- Verify the version doesn't already exist on NPM
160+
- Check that OIDC Trusted Publishers are configured correctly
161+
- Review npm provenance documentation
162+
163+
## Security Considerations
164+
165+
- **Never manually modify releases**: All releases should be created by the automated workflow
166+
- **Verify downloads**: Always verify release artifacts using `gh attestation verify`
167+
- **Report issues**: If you find any security concerns, please report them responsibly
168+
169+
## Additional Resources
170+
171+
- [GitHub Immutable Releases Documentation](https://docs.github.com/en/repositories/releasing-projects-on-github/creating-releases/immutable-releases)
172+
- [GitHub Actions Artifact Attestation](https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)
173+
- [Sigstore Documentation](https://docs.sigstore.dev/)
174+
- [SLSA Framework](https://slsa.dev/)

0 commit comments

Comments
 (0)