Skip to content

Commit 64dd44d

Browse files
authored
ci: switch from SLSA provenance to actions/attest; update provenance docs (#26)
1 parent 68ea81e commit 64dd44d

5 files changed

Lines changed: 39 additions & 53 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
@@ -16,12 +12,6 @@ runs:
1612
shell: bash
1713
run: gem build launchdarkly-server-sdk-ai.gemspec
1814

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

.github/workflows/publish.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ on:
66
description: 'Is this a dry run. If so no package will be published.'
77
type: boolean
88
required: true
9-
tag_name:
10-
description: 'The tag name to use for the provenance file'
11-
type: string
12-
required: true
139

1410
workflow_dispatch:
1511
inputs:
@@ -25,8 +21,7 @@ jobs:
2521
permissions:
2622
id-token: write
2723
contents: write # Needed in this case to write github pages.
28-
outputs:
29-
gem-hash: ${{ steps.publish.outputs.gem-hash}}
24+
attestations: write
3025
steps:
3126
- uses: actions/checkout@v4
3227

@@ -56,14 +51,8 @@ jobs:
5651
with:
5752
token: ${{secrets.GITHUB_TOKEN}}
5853

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

.github/workflows/release-please.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ jobs:
1414
pull-requests: write
1515
outputs:
1616
release-created: ${{ steps.release.outputs.release_created }}
17-
tag-name: ${{ steps.release.outputs.tag_name }}
1817
steps:
1918
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4
2019
id: release
21-
20+
2221
release-sdk:
23-
needs: release-please
22+
needs: ['release-please']
2423
if: ${{ needs.release-please.outputs.release-created == 'true' }}
2524
uses: ./.github/workflows/publish.yml
2625
with:
2726
dry_run: false
28-
tag_name: ${{ needs.release-please.outputs.tag-name }}

PROVENANCE.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
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
```
11-
# Set the version of the SDK to verify
11+
# Set the version of the library to verify
1212
VERSION=0.3.0
1313
```
1414
<!-- x-release-please-end -->
@@ -17,27 +17,33 @@ VERSION=0.3.0
1717
# Download gem
1818
$ gem fetch launchdarkly-server-sdk-ai -v $VERSION
1919
20-
# Download provenance from Github release
21-
$ curl --location -O \
22-
https://github.com/launchdarkly/ruby-server-sdk-ai/releases/download/${VERSION}/launchdarkly-server-sdk-ai-${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-ai-${VERSION}.gem.intoto.jsonl \
27-
--source-uri github.com/launchdarkly/ruby-server-sdk-ai \
28-
launchdarkly-server-sdk-ai-${VERSION}.gem
20+
# Verify provenance using the GitHub CLI
21+
$ gh attestation verify launchdarkly-server-sdk-ai-${VERSION}.gem --owner launchdarkly
2922
```
3023

3124
Below is a sample of expected output.
32-
TODO: Verify these are accurate
25+
3326
```
34-
Verified signature against tlog entry index 83653185 at URL: https://rekor.sigstore.dev/api/v1/log/entries/24296fb24b8ad77a7df0bbf87a7d5fcaafa551a2101d9f993d251a56a918bb113e81d2c575dc7e25
35-
Verified build using builder "https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@refs/tags/v1.10.0" at commit 14c48a68c45871c27409591969e7f4c0ebdcdf62
36-
Verifying artifact launchdarkly-server-sdk-ai-1.0.0.gem: PASSED
27+
Loaded digest sha256:... for file://launchdarkly-server-sdk-ai-0.3.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-ai
42+
- Build workflow:. .github/workflows/release-please.yml
43+
- Signer repo:.... launchdarkly/ruby-server-sdk-ai
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 libraries from source.
49+
**Note:** These instructions do not apply when building our libraries from source.

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/server/ai/version.rb"]
9+
"extra-files": [
10+
"PROVENANCE.md",
11+
"lib/server/ai/version.rb"
12+
]
1013
}
1114
}
1215
}

0 commit comments

Comments
 (0)