Skip to content

Commit 8f740c2

Browse files
authored
Merge pull request #76 from LogFlames/document_sigstore
Add documentation for signing Maven releases with sigstore
2 parents 6d2a1e3 + 77fc3ae commit 8f740c2

File tree

3 files changed

+68
-4
lines changed

3 files changed

+68
-4
lines changed

index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ See [https://github.com/chains-project/](https://github.com/orgs/chains-project/
9494
- [Software supply chain attacks on crypto infrastructure](software-supply-chain-attacks-crypto.md)
9595
- [NIX and the supply chain, debrief of NixCon 2022](nixcon-2022.md)
9696
- [SBOMs for your GitHub Releases](sbom-github.md)
97+
- [Sigstore Attestations for your GitHub Releases](maven-sigstore.md)
9798
- [Software suply chain CWEs](cwe-software-supplu-chain.md)
9899
- [CHAINS checklist](chains-repo-checklist.md)
99100

maven-sigstore.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title: Pushing Sigstore Attestations to Maven Central on Release
3+
---
4+
5+
# Pushing Sigstore Attestations to Maven Central on Release
6+
7+
## Requirements
8+
9+
You need a project, a GitHub repository, and releases done with GitHub Actions. You also need a sigstore plugin that supports your build system.
10+
Here we show how to do it with maven and sigstore-maven-plugin.
11+
12+
## Steps
13+
14+
1. Add a plugin to your pom.xml. If you have a different build system, you can find the appropriate plugin here: [https://docs.sigstore.dev/language_clients/language_client_overview/](https://docs.sigstore.dev/language_clients/language_client_overview/).
15+
16+
```xml
17+
<properties>
18+
<sigstore.skip>true</sigstore.skip>
19+
</properties>
20+
```
21+
22+
```xml
23+
<build>
24+
<plugins>
25+
<plugin>
26+
<groupId>dev.sigstore</groupId>
27+
<artifactId>sigstore-maven-plugin</artifactId>
28+
<version>1.3.0</version>
29+
<configuration>
30+
<skip>${sigstore.skip}</skip>
31+
</configuration>
32+
<executions>
33+
<execution>
34+
<id>sign</id>
35+
<goals>
36+
<goal>sign</goal>
37+
</goals>
38+
</execution>
39+
</executions>
40+
</plugin>
41+
</plugins>
42+
</build>
43+
```
44+
45+
This will create a `<filename>.sigstore.json` with the attestation during the `sign` build step. We add the optional property `sigstore.skip` to make the default to not sign (for easier local development). Signing is then enabled during deployment builds using the maven argument: `-Dsigstore.skip=false`.
46+
47+
2. (GitHub) Add the `id-token` permission to your release job in GitHub Actions.
48+
49+
```yaml
50+
jobs:
51+
build:
52+
name: Build and release
53+
permissions:
54+
id-token: write
55+
[...]
56+
```
57+
58+
This enables OIDC authentication for the release job, which is required for signing artifacts with sigstore. For additional details, see the documentation for [sigstore-maven-plugin](https://github.com/sigstore/sigstore-java/tree/main/sigstore-maven-plugin).
59+
60+
3. (Maven Central) JReleaser automatically uploads the `<filename>.sigstore.json` files to Maven Central.
61+
62+
4. Make a release :) The final result looks like this on Maven Central: https://repo1.maven.org/maven2/io/github/chains-project/maven-lockfile/5.8.2/.
63+

sbom-github.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ By the end of this post, you will clearly understand how to add SBOMs to your so
2626

2727
## Steps
2828

29-
1. Add a plugin to your pom.xml. If you have a different build system, you can find the appropriate plugin here: https://cyclonedx.org/docs/bom-tools/
29+
1. Add a plugin to your pom.xml. If you have a different build system, you can find the appropriate plugin here: [https://cyclonedx.org/docs/bom-tools/](https://cyclonedx.org/docs/bom-tools/)
3030

3131
```xml
3232
<build>
@@ -69,17 +69,17 @@ By the end of this post, you will clearly understand how to add SBOMs to your so
6969

7070
```yml
7171
- name: Run JReleaser
72-
uses: jreleaser/release-action@f69e545b05f149483cecb2fb81866247992694b8
72+
uses: jreleaser/release-action@ad73772277e63d9f2bbf4f24a7bb1300388334d7 # 2.4.3
7373
with:
74-
version: 1.15.0
74+
version: 1.20.0
7575
arguments: full-release
7676
env:
7777
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
7878
[...]
7979
```
8080

8181
4. Make a release :)
82-
The final result looks like this on GitHub: https://github.com/chains-project/maven-lockfile/releases/tag/v5.3.5 and like this on Maven Central: https://repo1.maven.org/maven2/io/github/chains-project/maven-lockfile/5.3.5/.
82+
The final result looks like this on GitHub: https://github.com/chains-project/maven-lockfile/releases/tag/v5.8.2 and like this on Maven Central: https://repo1.maven.org/maven2/io/github/chains-project/maven-lockfile/5.8.2/.
8383

8484
## Conclusion
8585
In conclusion, adding SBOMs to your GitHub and Maven Central releases is a simple and effective way to improve the security and integrity of your software products. Following the steps outlined in this blog post, you can easily generate and add an SBOM to your GitHub and Maven Central release using Maven and JReleaser. With an SBOM, you can identify and remediate vulnerabilities in your software products on time, reducing the risk of security breaches and ensuring the trust of your users. We hope this post has helped guide you through adding SBOMs to your GitHub and Maven Central releases, and we encourage you to continue exploring ways to improve the security and quality of your software products.

0 commit comments

Comments
 (0)