BCR Provenance attestations #2721
loosebazooka
started this conversation in
Ideas
Replies: 2 comments 8 replies
-
I'm pleased you're following SLSA
Thanks! Chris |
Beta Was this translation helpful? Give feedback.
7 replies
-
I guess I'm asking for the client side tooling built into bazel (that you mention as a separate project) handles both BCR cases, and all other cases of pulling build tooling into bazel, in a unified way. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Bazel BCR Provenance
Goals
Non-Goals
Background
BCR
The Bazel Central Registry (BCR) is the default and recommended repository for Bazel modules used in the Bzlmod external dependency system. It's a centralized location where you can find and publish your preferred Bazel projects. The BCR website allows you to easily browse available modules.
Layout
From https://docs.bazel.build/versions/5.1.0/bzlmod.html
Each published module to /modules/$MODULE/$VERSION contains the following files (see https://bazel.build/external/registry for more details):
MODULE.bazel: The bazel module file of this module version. It contains the metadata about this model and its dependencies to other Bazel modules.
source.json: A JSON file containing information on how to fetch the source of this module version, with the following fields:
patches/: An optional directory containing patch files
Here is an example push to BCR
SLSA Build Attestations
Build Attestations are signed metadata about how (in this case) bazel modules were built and released to BCR. With build attestations, module consumers (bazel users or package repositories) can make some assertions about the source and packaging process of a module.. While other security measures exist for BCR, currently BCR provides no guidance on signatures or signed attestations over the releases.
For the purposes of this document we will be talking about SLSA provenance, but BCR may accept other types of metadata formats (ex: VSA)
Proposal: Provenance on Module build/release
Our processes for attestation generation must cover the following critical files:
Users may optionally choose to cover all files attached to a module release. However these are not necessary to make security assertions over the module release.
Any build/release process for a module must generate provenance attestations over all three objects and any consumer of a module that wants to verify provenance check that all files used are covered by a provenance file.
Build provenance over the source archive
Users should be able to trace back the source (source.json#url) archive to a repository and a trusted packaging system. An attestation over the source archive should contain a single subject (the source archive) and should exist next to the source archive. It may be replicated in other places (like BCR), but should be accessible without BCR.
The source typically exists as a release artifact in the Project repository. This is an archive (.tar/.zip) over the source at a specific commit, generated by git archive. BCR does not contain the source archive. An attestation reference over this object MUST point to the source archive location for it to be accessible from BCR.
Build Provenance over the critical BCR module objects (source.json, MODULE.bazel)
Users should be able to make cryptographic assertions about the provenance of module metadata (MODULE.bazel and source.json : example). These files contain enough information to make assertions over the entire release (including patches). Since they are created by a releaser (rather than source owner – which may or may not be the same person/machine id) the releaser would have to generate an attestation/signature at release time.
Build provenance over other files
To make assertions about a release without being bazel-aware, it might make sense to just attest to all objects uploaded as part of the release. If a developer wants to attach attestations to other files in addition to security critical files they can.
Attestation Details
Generation
The bazel release reusable workflow currently generated the source archive, simple modifications to this reusable workflow should be able to apply github artifact attestations directly to the source archival process, signed with the repositories workflow identity.
On the "easy path", the publish-to-bcr bot generates/hydrates source.json, MODULE.bazel and patches from repository templates. However this needs to be moved into a reusable workflow (either a new publish workflow or integrated into the existing release workflow) so that attestations can be produced using github actions workflow tokens and attributed to the repository directly. Apps such as the publish-to-bcr app do not have access to workflow identity tokens .
On github workflow id is a OIDC token associated with the developer/releasers github repository. In addition to the information embedded in the provenance, any signatures associated with provenances should have an identity tied to <organization>/<repository> and potentially can be refined using other OIDs embedded in the fulcio certificate.
Format
Each attestation bundle is an intoto-bundle which stores all attestations in a single file as a json-list. Where each line is a json formatted attestation in the file. Each attestation is a
Consumers of the bundle should ignore attestation types they don't understand.
The current intoto-bundle format only specifies how to list DSSE bundles, but the spec should be updated to allow sigstore-bundles and remote attestations in the format.
We want the attestation format to support both the open source usecase (signed with sigstore) and vsa/enterprise/google use case (signed with keys). All build attestations should standardize on DSSE signatures and may be wrapped in a sigstore bundle. Open source attestations on the "easy path" using bazel-build tooling are expected to be sigstore wrapped DSSE signatures generated by github signed using workflow identity.
An example bundle for open source projects using keyless sigstore signing might look like:
where the payload could look like
Extended support for other formats (VSA?)
Formats that are native DSSE without attached sigstore verification materials can simply include the DSSE bundle as the attestation.
where the VSA payload would look like
Storage and Discovery
Attestations will be stored according to the file naming convection defined in the intoto project
Attestation for files will be named <filename>.intoto.jsonl and may contain one or more types of attestations. For our purposes, this may contain one slsa attestation, one vsa or both to start with. Other types of attestations may be added for each file as the need arises.
Attestations will be stored and found both on github (or wherever the source archive is stored) and bcr. The attestation will be stored at the primary source of each module object.
An attestation may be reused if generated by the same process.This will likely lead to situations where attestations are duplicated for all the files in a module and that's fine.
Github/Source Archive
The attestation for the source archive should live with the source archive on Github. Typically this means as a release artifact in a github release.
BCR
Attestations related to the module release should exist with the module information, for the case of BCR this means they are published alongside module files.
Workflow examples
Workflow 1: Separate release and publish on github
Workflow 2: A single release and publish from github
Workflow 3: An enterprise generating VSA attestations for BCR release
BCR Checks
Future checks (not covered by this document)
BCR also surfaces provenance in their UI
The Metadata section can include build information of some kind. This is an example of what is possible with this new metadata, not a suggestion of what/how we surface this information.
Client Verification
Bazel clients wishing to verify attestations can check the attestation list and select the attestations that
It can then verify those attestations against a policy defined by the client. Tooling to do verification will not be built into bazel yet. A bazel-module-audit tools could do it.
Existing workflows for slsa verification
Beta Was this translation helpful? Give feedback.
All reactions