Help us shape the future of Go! Take the 2026 Go Developer Survey

slsa

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// GithubHostedActionsBuilderID is a default builder ID for Github hosted actions.
	GithubHostedActionsBuilderID = "https://github.com/Attestations/GitHubHostedActions@v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildType added in v1.0.0

type BuildType interface {
	// URI returns the build type's URI.
	URI() string

	// Subject returns a set of artifacts created by the build.
	Subject(context.Context) ([]intoto.Subject, error)

	// BuildConfig returns the buildConfig for this build type.
	BuildConfig(context.Context) (interface{}, error)

	// Invocation returns an invocation for this build type.
	Invocation(context.Context) (slsa02.ProvenanceInvocation, error)

	// Materials returns materials as defined by this build type.
	Materials(context.Context) ([]slsacommon.ProvenanceMaterial, error)

	// Metadata returns a metadata about the build.
	Metadata(context.Context) (*slsa02.ProvenanceMetadata, error)
}

BuildType implements generation of buildType specific elements of SLSA provenance. Each BuildType instance represents a specific build.

type ClientProvider added in v1.0.0

type ClientProvider interface {
	OIDCClient() (*github.OIDCClient, error)
	GithubClient(context.Context) (*githubapi.Client, error)
}

ClientProvider creates Github API clients.

type DefaultClientProvider added in v1.0.0

type DefaultClientProvider struct {
	// contains filtered or unexported fields
}

DefaultClientProvider provides a default set of clients based on the Github Actions environment.

func (*DefaultClientProvider) GithubClient added in v1.0.0

func (p *DefaultClientProvider) GithubClient(ctx context.Context) (*githubapi.Client, error)

GithubClient returns a Github API client authenticated with the token provided in the github context.

func (*DefaultClientProvider) OIDCClient added in v1.0.0

func (p *DefaultClientProvider) OIDCClient() (*github.OIDCClient, error)

OIDCClient returns a default OIDC client.

type GithubActionsBuild added in v1.0.0

type GithubActionsBuild struct {
	Context github.WorkflowContext
	Clients ClientProvider
	// contains filtered or unexported fields
}

GithubActionsBuild is a basic build type for builders running in GitHub Actions.

func NewGithubActionsBuild added in v1.0.0

func NewGithubActionsBuild(s []intoto.Subject, c *github.WorkflowContext) *GithubActionsBuild

NewGithubActionsBuild returns a new GithubActionsBuild that uses the GitHub context to generate information.

func (*GithubActionsBuild) BuildConfig added in v1.0.0

func (b *GithubActionsBuild) BuildConfig(context.Context) (interface{}, error)

BuildConfig implements BuildType.BuildConfig.

func (*GithubActionsBuild) Invocation added in v1.0.0

Invocation implements BuildType.Invocation. An invocation is returned that describes the workflow run. TODO: Document the basic invocation format.

func (*GithubActionsBuild) Materials added in v1.0.0

Materials implements BuildType.Materials. It returns a list of materials that includes the repository that triggered the GitHub Actions workflow.

func (*GithubActionsBuild) Metadata added in v1.0.0

Metadata implements BuildType.Metadata. It specifies that parameters are complete.

func (*GithubActionsBuild) Subject added in v1.0.0

Subject implements BuildType.Subject.

func (*GithubActionsBuild) WithClients added in v1.0.0

WithClients overrides the build type's default client provider. This is useful for tests where APIs are not available.

type HostedActionsGenerator added in v1.0.0

type HostedActionsGenerator struct {
	// contains filtered or unexported fields
}

HostedActionsGenerator is a SLSA provenance generator for Github Hosted Actions. Provenance is generated based on a "build type" which defines the format for many of the fields in the provenance metadata. Builders for different ecosystems (languages etc.) can implement a build type from scratch or by extending GithubActionsBuild.

func NewHostedActionsGenerator added in v1.0.0

func NewHostedActionsGenerator(bt BuildType) *HostedActionsGenerator

NewHostedActionsGenerator returns a SLSA provenance generator for the given build type.

func (*HostedActionsGenerator) Generate added in v1.0.0

Generate generates an in-toto provenance statement in SLSA v0.2 format.

func (*HostedActionsGenerator) WithClients added in v1.0.0

WithClients overrides the default ClientProvider. Useful for tests where clients are not available.

type NilClientProvider added in v1.0.0

type NilClientProvider struct{}

NilClientProvider does not provide clients. It is useful for testing where APIs are not available.

func (*NilClientProvider) GithubClient added in v1.0.0

func (p *NilClientProvider) GithubClient(context.Context) (*githubapi.Client, error)

GithubClient returns nil for the client.

func (*NilClientProvider) OIDCClient added in v1.0.0

func (p *NilClientProvider) OIDCClient() (*github.OIDCClient, error)

OIDCClient returns nil for the client.

type WorkflowParameters

type WorkflowParameters struct {
	// EventInputs is the inputs for the event that triggered the workflow.
	EventInputs interface{} `json:"event_inputs,omitempty"`
}

WorkflowParameters contains parameters given to the workflow invocation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL