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

Commit c32ff6d

Browse files
committed
adding slsa metadata
1 parent c5c8d76 commit c32ff6d

File tree

3 files changed

+68
-18
lines changed

3 files changed

+68
-18
lines changed

.github/workflows/publish.yml

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,68 @@
11
name: Publish Python Package
22

33
on:
4-
release:
5-
types: [created, updated]
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Release Tag'
8+
required: true
69

710
jobs:
8-
deploy:
9-
11+
build:
1012
runs-on: ubuntu-latest
11-
13+
outputs:
14+
hashes: ${{ steps.hash.outputs.hashes }}
1215
steps:
13-
- uses: actions/checkout@v2
14-
16+
- uses: actions/checkout@v4
17+
with:
18+
ref: ${{ inputs.tag }}
1519
- name: Set up Python
16-
uses: actions/setup-python@v2
20+
uses: actions/setup-python@v5
1721
with:
1822
python-version: '3.x'
19-
2023
- name: Install dependencies
2124
run: |
2225
python -m pip install --upgrade pip
2326
pip install setuptools wheel twine
24-
2527
- name: Build
2628
run: |
2729
python setup.py sdist bdist_wheel
28-
29-
- name: Publish
30-
env:
31-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
32-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
30+
- name: "Generate hashes"
31+
id: hash
3332
run: |
34-
twine upload dist/*
33+
cd dist && echo "hashes=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
34+
- uses: actions/upload-artifact@v4
35+
with:
36+
name: build
37+
path: ./dist
38+
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
50+
51+
publish-python-package-to-release:
52+
runs-on: ubuntu-latest
53+
needs: ['build']
54+
permissions:
55+
contents: write
56+
steps:
57+
- uses: actions/checkout@v4
58+
with:
59+
ref: ${{ inputs.tag }}
60+
- uses: actions/download-artifact@v4
61+
with:
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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,20 @@ Once set up, you can run the following core functions:
6262
------
6363

6464
* = Coming soon
65+
66+
## Provenance
67+
[![SLSA 3](https://slsa.dev/images/gh-badge-level3.svg)](https://slsa.dev)
68+
69+
To enhance the software supply chain security of Labelbox's users, as of 0.1.40, every release contains a [SLSA Level 3 Provenance](https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/generic/README.md) document.
70+
This document provides detailed information about the build process, including the repository and branch from which the package was generated.
71+
72+
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.
73+
74+
Example of usage for the 0.1.40 release wheel:
75+
76+
```
77+
VERSION=0.1.40 #tag
78+
gh release download 0.1.40 --repo Labelbox/labelpandas
79+
80+
slsa-verifier verify-artifact --source-branch master --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/labelpandas" --provenance-path multiple.intoto.jsonl ./labelpandas-${VERSION}-py3-none-any.whl
81+
```

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.

0 commit comments

Comments
 (0)