Skip to content
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

Provenance build-step analysis #10

Open
jedevc opened this issue Jan 19, 2023 · 0 comments
Open

Provenance build-step analysis #10

jedevc opened this issue Jan 19, 2023 · 0 comments

Comments

@jedevc
Copy link
Contributor

jedevc commented Jan 19, 2023

We can use the new SLSA provenance attestations to extract source information from an image.

Example use cases:

  • Provide a more accurate image history view (e.g. on hub)

We should provide a way to lookup build step identifiers (e.g. sha256 digests, diffids, stage numbers, etc) in the sourcemap and return the LLB used to build it, as well as the source-mapping for the original component - I think it should be valid to allow a flexible lookup using different types of identifiers for this?

If SLSA provenance isn't available, we should provide fallbacks using the image config history - we can't reconstruct the LLB, but we can some guesses as to the original source code and build-steps using the layers - though this is definitely outside the initial scope.

For example, a struct might look something like this:

type Image struct {
    // ...
    BuildSteps []BuildStep
}

// GetBuildStep is a helper utility to get a BuildStep using a BuildStepIdentifier, could be an interface or similar that could be the sha256 digest of the layer, the DiffID for that layer, the stage name for that layer, etc.
func (img Image) GetBuildStep(id BuildStepIdentifier) BuildStep { ... }

type BuildStep struct {
    Digest digest.Digest
    DiffID digest.Digest
    Stage string  // e.g. stage0

    LLB
    Source
}

Ideally, if we can, we should represent Source in a VCS-rich way, so not only should it be possible to get the string that represents that snippet, but if we have Git metadata, we can attempt to link it back to source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant