Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit ce17728

Browse files
authored
Merge pull request #9 from Labelbox/DEVOPS-3097
DEVOPS-3097 - adding slsa metadata
2 parents 3fad838 + d5e4e43 commit ce17728

File tree

4 files changed

+73
-37
lines changed

4 files changed

+73
-37
lines changed

.github/workflows/publish.yml

Lines changed: 53 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,68 @@
1-
# Triggers a pypi publication when a release is created
2-
31
name: Publish Python Package
42

53
on:
6-
release:
7-
types: [created]
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Release Tag'
8+
required: true
89

910
jobs:
1011
build:
1112
runs-on: ubuntu-latest
13+
outputs:
14+
hashes: ${{ steps.hash.outputs.hashes }}
1215
steps:
13-
- uses: actions/checkout@v4
14-
15-
- uses: actions/setup-python@v5
16-
with:
17-
python-version: '3.x'
16+
- uses: actions/checkout@v4
17+
with:
18+
ref: ${{ inputs.tag }}
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.x'
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install setuptools wheel twine
27+
- name: Build
28+
run: |
29+
python setup.py sdist bdist_wheel
30+
- name: "Generate hashes"
31+
id: hash
32+
run: |
33+
cd dist && echo "hashes=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
34+
- uses: actions/upload-artifact@v4
35+
with:
36+
name: build
37+
path: ./dist
1838

19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install setuptools wheel
23-
24-
- name: Build
25-
run: |
26-
python setup.py sdist bdist_wheel
27-
28-
- uses: actions/upload-artifact@v4
29-
with:
30-
path: ./dist
39+
provenance_python:
40+
needs: [build]
41+
permissions:
42+
actions: read
43+
contents: write
44+
id-token: write # Needed to access the workflow's OIDC identity.
45+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
46+
with:
47+
base64-subjects: "${{ needs.build.outputs.hashes }}"
48+
upload-assets: true
49+
upload-tag-name: ${{ inputs.tag }} # Tag from the initiation of the workflow
3150

32-
pypi-publish:
33-
needs: ['build']
34-
environment:
35-
name: publish
36-
url: 'https://pypi.org/project/labelboxbigquery/'
51+
publish-python-package-to-release:
3752
runs-on: ubuntu-latest
53+
needs: ['build']
3854
permissions:
39-
# IMPORTANT: this permission is mandatory for trusted publishing
40-
id-token: write
55+
contents: write
4156
steps:
57+
- uses: actions/checkout@v4
58+
with:
59+
ref: ${{ inputs.tag }}
4260
- uses: actions/download-artifact@v4
43-
44-
- name: Publish package distributions to PyPI
45-
uses: pypa/gh-action-pypi-publish@release/v1.8
4661
with:
47-
packages-dir: artifact/
48-
49-
# Note that the build and pypi-publish jobs are split so that the additional permissions are only granted to the pypi-publish job.
62+
name: build
63+
path: ./artifact
64+
- name: Upload dist to release
65+
run: |
66+
gh release upload ${{ inputs.tag }} ./artifact/*
67+
env:
68+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,21 @@ The `client` class requires the following arguments:
4141
- `lb_api_key` = Labelbox API Key
4242
- `google_key` = Google Service Account Permissions dict, how to create one [here](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating)
4343
- `google_project_name` = Google Project ID / Name
44+
45+
46+
## Provenance
47+
[![SLSA 3](https://slsa.dev/images/gh-badge-level3.svg)](https://slsa.dev)
48+
49+
To enhance the software supply chain security of Labelbox's users, as of 0.1.8, every release contains a [SLSA Level 3 Provenance](https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/generic/README.md) document.
50+
This document provides detailed information about the build process, including the repository and branch from which the package was generated.
51+
52+
By using the [SLSA framework's official verifier](https://github.com/slsa-framework/slsa-verifier), you can verify the provenance document to ensure that the package is from a trusted source. Verifying the provenance helps confirm that the package has not been tampered with and was built in a secure environment.
53+
54+
Example of usage for the 0.1.8 release wheel:
55+
56+
```
57+
VERSION=0.1.8 #tag
58+
gh release download ${VERSION} --repo Labelbox/labelbox-bigquery
59+
60+
slsa-verifier verify-artifact --source-branch main --builder-id 'https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@refs/tags/v2.0.0' --source-uri "git+https://github.com/Labelbox/labelbox-bigquery" --provenance-path multiple.intoto.jsonl ./labelboxbigquery-${VERSION}-py3-none-any.whl
61+
```

SECURITY.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please contact security@labelbox.com for any vulnerability that needs to be reported
6-
with labelbox-python. We will get back to you as soon as we can.
5+
Please contact security@labelbox.com for any vulnerability that needs to be reported. We will get back to you as soon as we can.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="labelboxbigquery",
8-
version="0.1.07",
8+
version="0.1.8",
99
author="Labelbox",
1010
author_email="raphael@labelbox.com",
1111
description="Labelbox Connector for BigQuery",

0 commit comments

Comments
 (0)