attest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExpectedIssuer is the OIDC issuer found in the sigstore bundles
	ExpectedIssuer = "https://token.actions.githubusercontent.com"

	// Expected SAN is the expected identity of the workflow signing the
	// provenance and VSAs.
	ExpectedSan = "https://github.com/slsa-framework/source-actions/.github/workflows/compute_slsa_source.yml@refs/heads/main"

	// OldExpectedSan is the old singer identity before splitting out the actions to their own repo
	// this constant is part of a compatibility hack that should be reverted once the latests attestations
	// of the repos are signed with the new identity.
	//
	// See https://github.com/slsa-framework/source-tool/issues/255
	OldExpectedSan = "https://github.com/slsa-framework/slsa-source-poc/.github/workflows/compute_slsa_source.yml@refs/heads/main"
)
View Source
const (
	VsaPredicateType = "https://slsa.dev/verification_summary/v1"
	VsaVerifierId    = "https://github.com/slsa-framework/source-actions"
)

Variables

TODO: Update ExpectedSan to support regex so we can get the branches/tags we really think folks should be using (they won't all run from main).

Functions

func CreateUnsignedSourceVsa

func CreateUnsignedSourceVsa(branch *models.Branch, commit *models.Commit, verifiedLevels slsa.SourceVerifiedLevels, policy string) (string, error)

func Debugf

func Debugf(format string, args ...any)

func GetSourceProvPred

func GetSourceProvPred(statement *intoto.Statement) (*provenance.SourceProvenancePred, error)

func GetSourceRefsForCommit

func GetSourceRefsForCommit(att attestation.Envelope, commit *models.Commit) ([]string, error)

GetSourceRefsForCommit returns the source branch annotations from the subject

func GetSubjectForCommit

func GetSubjectForCommit(att attestation.Envelope, commit *models.Commit) *intoto.ResourceDescriptor

Returns the _first_ subject that includes the commit. TODO: add support for multiple subjects...

func GetTagProvPred

func GetTagProvPred(statement *intoto.Statement) (*provenance.TagProvenancePred, error)

func Sign

func Sign(data string) (string, error)

func StatementToString

func StatementToString(stmt *intoto.Statement) string

Just make this easy for logging...

func WithAuthenticator added in v0.7.0

func WithAuthenticator(athn *auth.Authenticator) optFn

func WithBackend added in v0.7.0

func WithBackend(b models.VcsBackend) optFn

func WithGithubCollector added in v0.7.0

func WithGithubCollector(yesno bool) optFn

func WithNotesCollector added in v0.7.0

func WithNotesCollector(yesno bool) optFn

func WithRepository added in v0.7.0

func WithRepository(repos ...string) optFn

func WithRetries added in v0.7.0

func WithRetries(r uint8) optFn

func WithVerifier added in v0.7.0

func WithVerifier(vf Verifier) optFn

Types

type Attester added in v0.7.0

type Attester struct {
	Options AttesterOptions
	// contains filtered or unexported fields
}

func NewAttester added in v0.7.0

func NewAttester(fn ...optFn) (*Attester, error)

NewAttester creates a new attester

func (*Attester) CreateSourceProvenance added in v0.7.0

func (a *Attester) CreateSourceProvenance(ctx context.Context, branch *models.Branch, commit *models.Commit) (*intoto.Statement, error)

prevAttPath string

func (*Attester) CreateTagProvenance added in v0.7.0

func (a *Attester) CreateTagProvenance(ctx context.Context, branch *models.Branch, tag *models.Tag, actor string) (*intoto.Statement, error)

CreateTagProvenance creates a provenance statement for a tag.

func (*Attester) GetRevisionProvenance added in v0.7.0

func (a *Attester) GetRevisionProvenance(ctx context.Context, branch *models.Branch, commit *models.Commit) (*provenance.SourceProvenancePred, error)

GetRevisionProvenance returns the provenance attestation for a commit by querying the configured collectors.

func (*Attester) GetRevisionVSA added in v0.7.0

func (a *Attester) GetRevisionVSA(ctx context.Context, branch *models.Branch, revision models.Revision) (attestation.Envelope, *vsa.VerificationSummary, error)

GetRevisionVSA returns a revision's VSA attestation

func (*Attester) Validate added in v0.7.0

func (a *Attester) Validate() error

Validate checks that the attester configuration is complete

type AttesterOptions added in v0.7.0

type AttesterOptions struct {
	// Initialize dynamic notes fetcher and storer
	InitNotesCollector bool

	// Initialize attestations store collector and storer
	InitGHCollector bool

	// Additional read repositories
	Repos []string

	// Times to retry fetching attestations
	Retries uint8
}

type BndVerifier

type BndVerifier struct {
	Options VerificationOptions
}

func NewBndVerifier

func NewBndVerifier(opts VerificationOptions) *BndVerifier

func (*BndVerifier) Verify

func (bv *BndVerifier) Verify(data string) (*verify.VerificationResult, error)

func (*BndVerifier) VerifyEnvelope added in v0.7.0

func (bv *BndVerifier) VerifyEnvelope(env attestation.Envelope) error

VerifyEnvelope verifies the signature of an attestation envelope fetched by the collector and checks that the signer matches the expected identity (issuer + SAN) or one of the accepted alternate identities.

type VerificationOptions

type VerificationOptions struct {
	ExpectedIssuer string
	ExpectedSan    string

	// AlternateSans lists additional signer identities accepted when
	// verifying attestations. It carries the pre-rename workflow identity
	// while repositories still have attestations signed with it.
	//
	// See https://github.com/slsa-framework/source-tool/issues/255
	AlternateSans []string
}

type Verifier

type Verifier interface {
	Verify(data string) (*verify.VerificationResult, error)

	// VerifyEnvelope checks the cryptographic signature of a parsed
	// attestation envelope and ensures the signer matches the expected
	// identity. Envelopes that carry no verifiable signature (eg bare
	// statements) must return an error.
	VerifyEnvelope(env attestation.Envelope) error
}

func GetDefaultVerifier

func GetDefaultVerifier() Verifier

Jump to

Keyboard shortcuts

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