Skip to content
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions verifiers/internal/gha/provenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,40 @@ func isValidDelegatorBuilderID(prov iface.Provenance) error {
if err != nil {
return err
}

sourceURI, err := prov.SourceURI()
if err != nil {
return err
}

uri, _, err := utils.ParseGitURIAndRef(sourceURI)
if err != nil {
return err
}

parts := strings.Split(id, "@")
if len(parts) != 2 {
return fmt.Errorf("%w: %s", serrors.ErrorInvalidBuilderID, id)
}
builderRef := parts[1]

// Exception for JReleaser builders.
// See https://github.com/slsa-framework/slsa-github-generator/issues/2035#issuecomment-1579963802.
if strings.HasPrefix(parts[0], JReleaserRepository) {
return utils.IsValidJreleaserBuilderTag(parts[1])
return utils.IsValidJreleaserBuilderTag(builderRef)
}
return utils.IsValidBuilderTag(parts[1], false)

// Exeption to enable e2e tests for BYOB builders referenced at main.
normalizedE2eRepoUri := utils.NormalizeGitURI(httpsGithubCom + e2eTestRepository)
normalizedUri := utils.NormalizeGitURI(uri)
if normalizedUri == normalizedE2eRepoUri && options.TestingEnabled() {
// Allow verification on the main branch to support e2e tests.
if builderRef == "refs/heads/main" {
return nil
}
}

return utils.IsValidBuilderTag(builderRef, false)
}

// builderID returns the trusted builder ID from the provenance.
Expand Down