Skip to content

Commit 013f4d0

Browse files
authored
ci: switch from SLSA provenance to actions/attest with subject-path (#377)
1 parent b44ea86 commit 013f4d0

6 files changed

Lines changed: 43 additions & 66 deletions

File tree

.github/actions/publish/action.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ inputs:
44
dry_run:
55
description: 'Is this a dry run. If so no package will be published.'
66
required: true
7-
outputs:
8-
gem-hash:
9-
description: "base64-encoded sha256 hashes of distribution files"
10-
value: ${{ steps.gem-hash.outputs.gem-hash }}
117

128
runs:
139
using: composite
@@ -17,12 +13,6 @@ runs:
1713
pattern: 'gems-*'
1814
merge-multiple: true
1915

20-
- name: Hash gem for provenance
21-
id: gem-hash
22-
shell: bash
23-
run: |
24-
echo "gem-hash=$(sha256sum launchdarkly-server-sdk-*.gem | base64 -w0)" >> "$GITHUB_OUTPUT"
25-
2616
- name: Publish Library
2717
shell: bash
2818
if: ${{ inputs.dry_run == 'false' }}

.github/workflows/manual-publish.yml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ jobs:
2222
runs-on: ubuntu-latest
2323
needs: ["build-ruby-gem", "build-jruby-gem"]
2424

25-
outputs:
26-
gem-hash: ${{ steps.publish.outputs.gem-hash }}
27-
2825
permissions:
2926
id-token: write # Needed if using OIDC to get release secrets.
3027
contents: write
28+
attestations: write # Needed for actions/attest.
3129

3230
steps:
3331
- uses: actions/checkout@v4
@@ -39,7 +37,7 @@ jobs:
3937

4038
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
4139
name: "Get rubygems API key"
42-
if: ${{ !inputs.dry_run }}
40+
if: ${{ format('{0}', inputs.dry_run) == 'false' }}
4341
with:
4442
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
4543
ssm_parameter_pairs: "/production/common/releasing/rubygems/api_key = GEM_HOST_API_KEY"
@@ -52,19 +50,12 @@ jobs:
5250
dry_run: ${{ inputs.dry_run }}
5351

5452
- uses: ./.github/actions/publish-docs
55-
if: ${{ !inputs.dry_run }}
53+
if: ${{ format('{0}', inputs.dry_run) == 'false' }}
5654
with:
5755
token: ${{secrets.GITHUB_TOKEN}}
5856

59-
release-provenance:
60-
needs: ["publish"]
61-
62-
permissions:
63-
actions: read
64-
id-token: write
65-
contents: write
66-
67-
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
68-
with:
69-
base64-subjects: "${{ needs.publish.outputs.gem-hash }}"
70-
upload-assets: ${{ !inputs.dry_run }}
57+
- name: Attest build provenance
58+
if: ${{ format('{0}', inputs.dry_run) == 'false' }}
59+
uses: actions/attest@v4
60+
with:
61+
subject-path: 'launchdarkly-server-sdk-*.gem'

.github/workflows/release-please.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515

1616
outputs:
1717
release-created: ${{ steps.release.outputs.release_created }}
18-
upload-tag-name: ${{ steps.release.outputs.tag_name }}
1918

2019
steps:
2120
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
@@ -40,12 +39,10 @@ jobs:
4039
needs: ["release-package", "build-ruby-gem", "build-jruby-gem"]
4140
if: ${{ needs.release-package.outputs.release-created == 'true' }}
4241

43-
outputs:
44-
gem-hash: ${{ steps.publish.outputs.gem-hash }}
45-
4642
permissions:
4743
id-token: write # Needed if using OIDC to get release secrets.
4844
contents: write # Contents and pull-requests are for release-please to make releases.
45+
attestations: write # Needed for actions/attest.
4946

5047
steps:
5148
- uses: actions/checkout@v4
@@ -72,17 +69,7 @@ jobs:
7269
with:
7370
token: ${{ secrets.GITHUB_TOKEN }}
7471

75-
release-provenance:
76-
needs: ["release-package", "publish"]
77-
if: ${{ needs.release-package.outputs.release-created == 'true' }}
78-
79-
permissions:
80-
actions: read
81-
id-token: write
82-
contents: write
83-
84-
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
85-
with:
86-
base64-subjects: "${{ needs.publish.outputs.gem-hash }}"
87-
upload-assets: true
88-
upload-tag-name: ${{ needs.release-package.outputs.upload-tag-name }}
72+
- name: Attest build provenance
73+
uses: actions/attest@v4
74+
with:
75+
subject-path: 'launchdarkly-server-sdk-*.gem'

PROVENANCE.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
## Verifying SDK build provenance with the SLSA framework
1+
## Verifying SDK build provenance with GitHub artifact attestations
22

3-
LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages.
3+
LaunchDarkly uses [GitHub artifact attestations](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages.
44

5-
As part of [SLSA requirements for level 3 compliance](https://slsa.dev/spec/v1.0/requirements), LaunchDarkly publishes provenance about our SDK package builds using [GitHub's generic SLSA3 provenance generator](https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/generic/README.md#generation-of-slsa3-provenance-for-arbitrary-projects) for distribution alongside our packages. These attestations are available for download from the GitHub release page for the release version under Assets > `multiple-provenance.intoto.jsonl`.
5+
LaunchDarkly publishes provenance about our SDK package builds using [GitHub's `actions/attest` action](https://github.com/actions/attest). These attestations are stored in GitHub's attestation API and can be verified using the [GitHub CLI](https://cli.github.com/).
66

7-
To verify SLSA provenance attestations, we recommend using [slsa-verifier](https://github.com/slsa-framework/slsa-verifier). Example usage for verifying SDK packages is included below:
7+
To verify build provenance attestations, we recommend using the [GitHub CLI `attestation verify` command](https://cli.github.com/manual/gh_attestation_verify). Example usage for verifying SDK packages is included below:
88

99
<!-- x-release-please-start-version -->
1010
```
@@ -17,27 +17,33 @@ SDK_VERSION=8.13.0
1717
# Download gem
1818
$ gem fetch launchdarkly-server-sdk -v $SDK_VERSION
1919
20-
# Download provenance from Github release
21-
$ curl --location -O \
22-
https://github.com/launchdarkly/ruby-server-sdk/releases/download/${SDK_VERSION}/launchdarkly-server-sdk-${SDK_VERSION}.gem.intoto.jsonl
23-
24-
# Run slsa-verifier to verify provenance against package artifacts
25-
$ slsa-verifier verify-artifact \
26-
--provenance-path launchdarkly-server-sdk-${SDK_VERSION}.gem.intoto.jsonl \
27-
--source-uri github.com/launchdarkly/ruby-server-sdk \
28-
launchdarkly-server-sdk-${SDK_VERSION}.gem
20+
# Verify provenance using the GitHub CLI
21+
$ gh attestation verify launchdarkly-server-sdk-${SDK_VERSION}.gem --owner launchdarkly
2922
```
3023

3124
Below is a sample of expected output.
3225

3326
```
34-
Verified signature against tlog entry index 78214752 at URL: https://rekor.sigstore.dev/api/v1/log/entries/24296fb24b8ad77ab941c118ef7e0b2d656b962a0d670c6ac91cfa37d07b7b121ae560b00a978ecf
35-
Verified build using builder "https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@refs/tags/v1.7.0" at commit f43b3ad834103fdc282652efbfe4963e8dfa737b
36-
Verifying artifact launchdarkly-server-sdk-8.3.0.gem: PASSED
27+
Loaded digest sha256:... for file://launchdarkly-server-sdk-8.13.0.gem
28+
Loaded 1 attestation from GitHub API
29+
30+
The following policy criteria will be enforced:
31+
- Predicate type must match:................ https://slsa.dev/provenance/v1
32+
- Source Repository Owner URI must match:... https://github.com/launchdarkly
33+
- Subject Alternative Name must match regex: (?i)^https://github.com/launchdarkly/
34+
- OIDC Issuer must match:................... https://token.actions.githubusercontent.com
35+
36+
✓ Verification succeeded!
37+
38+
The following 1 attestation matched the policy criteria
3739
38-
PASSED: Verified SLSA provenance
40+
- Attestation #1
41+
- Build repo:..... launchdarkly/ruby-server-sdk
42+
- Build workflow:. .github/workflows/release-please.yml
43+
- Signer repo:.... launchdarkly/ruby-server-sdk
44+
- Signer workflow: .github/workflows/release-please.yml
3945
```
4046

41-
Alternatively, to verify the provenance manually, the SLSA framework specifies [recommendations for verifying build artifacts](https://slsa.dev/spec/v1.0/verifying-artifacts) in their documentation.
47+
For more information, see [GitHub's documentation on verifying artifact attestations](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds#verifying-artifact-attestations-with-the-github-cli).
4248

43-
**Note:** These instructions do not apply when building our SDKs from source.
49+
**Note:** These instructions do not apply when building our SDKs from source.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ We encourage pull requests and other contributions from the community. Check out
4343
Verifying SDK build provenance with the SLSA framework
4444
------------
4545

46-
LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the [provenance guide](PROVENANCE.md).
46+
LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the [provenance guide](PROVENANCE.md).
4747

4848
About LaunchDarkly
4949
-----------

release-please-config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"versioning": "default",
77
"include-component-in-tag": false,
88
"include-v-in-tag": false,
9-
"extra-files": ["PROVENANCE.md", "lib/ldclient-rb/version.rb"]
9+
"extra-files": [
10+
"PROVENANCE.md",
11+
"lib/ldclient-rb/version.rb"
12+
]
1013
}
1114
}
1215
}

0 commit comments

Comments
 (0)