Documentation
¶
Index ¶
- Constants
- Variables
- func CreateUnsignedSourceVsa(branch *models.Branch, commit *models.Commit, ...) (string, error)
- func Debugf(format string, args ...any)
- func GetSourceProvPred(statement *intoto.Statement) (*provenance.SourceProvenancePred, error)
- func GetSourceRefsForCommit(att attestation.Envelope, commit *models.Commit) ([]string, error)
- func GetSubjectForCommit(att attestation.Envelope, commit *models.Commit) *intoto.ResourceDescriptor
- func GetTagProvPred(statement *intoto.Statement) (*provenance.TagProvenancePred, error)
- func Sign(data string) (string, error)
- func StatementToString(stmt *intoto.Statement) string
- func WithAuthenticator(athn *auth.Authenticator) optFn
- func WithBackend(b models.VcsBackend) optFn
- func WithGithubCollector(yesno bool) optFn
- func WithNotesCollector(yesno bool) optFn
- func WithRepository(repos ...string) optFn
- func WithRetries(r uint8) optFn
- func WithVerifier(vf Verifier) optFn
- type Attester
- func (a *Attester) CreateSourceProvenance(ctx context.Context, branch *models.Branch, commit *models.Commit) (*intoto.Statement, error)
- func (a *Attester) CreateTagProvenance(ctx context.Context, branch *models.Branch, tag *models.Tag, actor string) (*intoto.Statement, error)
- func (a *Attester) GetRevisionProvenance(ctx context.Context, branch *models.Branch, commit *models.Commit) (*provenance.SourceProvenancePred, error)
- func (a *Attester) GetRevisionVSA(ctx context.Context, branch *models.Branch, revision models.Revision) (attestation.Envelope, *vsa.VerificationSummary, error)
- func (a *Attester) Validate() error
- type AttesterOptions
- type BndVerifier
- type VerificationOptions
- type Verifier
Constants ¶
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" )
const ( VsaPredicateType = "https://slsa.dev/verification_summary/v1" VsaVerifierId = "https://github.com/slsa-framework/source-actions" )
Variables ¶
var DefaultVerifierOptions = VerificationOptions{ ExpectedIssuer: ExpectedIssuer, ExpectedSan: ExpectedSan, AlternateSans: []string{OldExpectedSan}, }
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 GetSourceProvPred ¶
func GetSourceProvPred(statement *intoto.Statement) (*provenance.SourceProvenancePred, error)
func GetSourceRefsForCommit ¶
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 StatementToString ¶
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
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
type AttesterOptions ¶ added in v0.7.0
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