-
Notifications
You must be signed in to change notification settings - Fork 108
add Python hash integrity docs #2964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
410a217
978e5fa
0625375
bdd954c
9d93f4c
3122248
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -314,27 +314,55 @@ curl -L --user "$CHAINGUARD_PYTHON_IDENTITY_ID:$CHAINGUARD_PYTHON_TOKEN" \ | |||||
|
|
||||||
| The option `-L` is required to follow redirects for the actual file locations. | ||||||
|
|
||||||
| ## Hash verification when migrating to Chainguard Libraries | ||||||
|
|
||||||
| Because Chainguard rebuilds from source, there are some circumstances where you | ||||||
| can expect different checksums for the same package version when migrating from | ||||||
| upstream PyPI to Chainguard Libraries: | ||||||
|
|
||||||
| - Tools such as `pip` enforce hashes when using `--require-hashes` or when hashes are pinned in requirements.txt files | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it enforces hash verification (between lock file and downloaded file) .. not "enforce hashes" .. I am not sure what that even means |
||||||
| - Tools such as `Poetry` and `uv` generate lock files that include SHA-256 hashes and will fail if checksums don't match | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't that also the case for pip ? Also dont use future "will fail" and detail what actually fails |
||||||
| - Systems such as JFrog Artifactory or Nexus may have cached upstream PyPI wheels and continue serving them until caches are cleared | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Sure but that might or might not have an effect on their use .. so what are we saying here |
||||||
|
|
||||||
| ### Resolving checksum mismatches | ||||||
|
|
||||||
| >Note: Before regenerating lock files, ensure your tool is configured to use Chainguard as the package index by following the [global configuration](chainguard/libraries/python/global-configuration/) or [direct access](/chainguard/libraries/python/build-configuration/#direct-access) documentation. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not worth making a note of this .. jsut use a normal sentence |
||||||
|
|
||||||
| To resolve hash mismatches, re-resolve your dependencies against Chainguard Libraries: | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolve twice sound weird .. also I think we need to reword this along the lines of adjusting to the new checksum values and updating the lock files so build dont fail. |
||||||
|
|
||||||
| - For `--require-hashes`: install from Chainguard indexes, and then regenerate the requirements file with new hashes so they match Chainguard wheels. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The requirements file stays the same .. the lock file has to be changed
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also .. don't use the term "Chainguard indexes" or "Chainguard wheels" .. use Chainguard Libraries for Python as product name or just talk about the indexes maybe and instead of wheels talk about Python packages (since we also do sdists and so) |
||||||
| - For `uv`, Poetry, or other tools that generate lockfiles: Point them at Chainguard indexes, and then regenerate the lockfile so stored hashes correspond to Chainguard artifacts. | ||||||
| - For repository managers: You may also need to clear cached PyPI artifacts to ensure future installs pull Chainguard's versions. | ||||||
|
|
||||||
| >**Note:** While hash mismatches from are expected for some tooling and | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from what? |
||||||
| configurations, you can verify the authenticity and provenance of Chainguard | ||||||
| packages using SBOM and SLSA attestation files as described in the next section. | ||||||
|
|
||||||
| ## SBOM and attestation files | ||||||
|
|
||||||
| Chainguard Libraries for Python include files that contain software bill of | ||||||
| material (SBOM) information. Additional files attest details about build | ||||||
| infrastructure with the [Supply-chain Levels for Software Artifacts | ||||||
| (SLSA)](https://slsa.dev/) provenance information. | ||||||
|
|
||||||
| ### Embedded SBOMs | ||||||
|
|
||||||
| The related files for Chainguard Libraries for Python are located within the | ||||||
| Python wheel file for each package following the [PEP 770 Improving | ||||||
| measurability of Python packages with Software Bill-of-Materials | ||||||
| specification](https://peps.python.org/pep-0770/) for software composition | ||||||
| analytis (SCA) using the SPDX format. | ||||||
|
|
||||||
| Specifically a wheel file contains two directories, the main code directory that | ||||||
| uses the name of the library only, and the version-specific distribution info | ||||||
| directory `.dist.info`. For example, the wheel archive for Flask version 2.0.0 | ||||||
| A wheel file contains two directories: | ||||||
| - The main code directory that uses the name of the library only, and | ||||||
| - The version-specific distribution info directory `.dist.info`. | ||||||
|
|
||||||
| For example, the wheel archive for Flask version 2.0.0 | ||||||
| includes a directory `flask-2.0.0.dist.info`. You can also find this directory | ||||||
| in the `site-packages` directory of a Python project using a virtual environment. | ||||||
|
|
||||||
| Find the SBOM information in the file `sboms/sbom.spdx.json`. Any package from | ||||||
| Chainguard includes the reference to Chainguard in the creators section: | ||||||
| The SBOM information is in the file `*.dist-info/sboms/sbom.spdx.json`. Any package from | ||||||
| Chainguard includes a reference to Chainguard in the `creators` section: | ||||||
|
|
||||||
| ```json | ||||||
| { | ||||||
|
|
@@ -355,6 +383,8 @@ Chainguard includes the reference to Chainguard in the creators section: | |||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ### SLSA provenance | ||||||
|
|
||||||
| SLSA provenance is available from the Chainguard Python index following the [PEP | ||||||
| 740 – Index support for digital attestations | ||||||
| specification](https://peps.python.org/pep-0740/) within the integrity context | ||||||
|
|
@@ -392,7 +422,13 @@ Packages from Chainguard are identified by the `publisher`:`environment` set as | |||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ### Sigstore bundle | ||||||
|
|
||||||
| A Sigstore bundle is a self‑contained JSON file that packages everything needed | ||||||
| to verify the authenticity and integrity of a signed artifact. | ||||||
|
|
||||||
| A [Sigstore bundle file](https://docs.sigstore.dev/about/bundle/) is available | ||||||
s-stumbo marked this conversation as resolved.
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move that link up to first sentence I guess |
||||||
| as `bundle.json` from the integrity context at | ||||||
| `https://libraries.cgr.dev/python/integrity/PACKAGE/VERSION/FILE/bundle.json` | ||||||
| specifically for each package, version, and file. | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think checksums will be different in nearly all circumstances at least for Python so you might need to reword