Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 41 additions & 5 deletions content/chainguard/libraries/python/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

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

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
Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Systems such as JFrog Artifactory or Nexus may have cached upstream PyPI wheels and continue serving them until caches are cleared
- Repository managers such as JFrog Artifactory or Sonatype Nexus may have cached upstream wheels and continue serving them until caches are cleared

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.
Copy link
Member

Choose a reason for hiding this comment

The 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:
Copy link
Member

Choose a reason for hiding this comment

The 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.
Copy link
Member

Choose a reason for hiding this comment

The 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

Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The 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
{
Expand All @@ -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
Expand Down Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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.