mirror of
https://github.com/slsa-framework/slsa-verifier.git
synced 2026-05-06 00:26:39 +00:00
allow slsa-framework/slsa-github-generator provenances from other branches in testing mode
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
This commit is contained in:
@@ -330,6 +330,13 @@ func isValidDelegatorBuilderID(prov iface.Provenance) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Exception for slsa-framework/slsa-github-generator branches during testing mode
|
||||
// to allow provenance from non-main to be verified, such as during development.
|
||||
normalizedSLSAGithubGeneratorRepoURI := utils.NormalizeGitURI(httpsGithubCom + trustedBuilderRepository)
|
||||
if options.TestingEnabled() && normalizedURI == utils.NormalizeGitURI(normalizedSLSAGithubGeneratorRepoURI) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return utils.IsValidBuilderTag(builderRef, false)
|
||||
}
|
||||
|
||||
|
||||
@@ -471,6 +471,18 @@ func Test_isValidDelegatorBuilderID(t *testing.T) {
|
||||
builderID: "some/builderID@refs/heads/main",
|
||||
testingEnabled: true,
|
||||
},
|
||||
{
|
||||
name: "invalid builder: ref slsa-github-generator repo: testing enabled",
|
||||
sourceURI: gitPrefix + httpsGithubCom + "slsa-framework/slsa-github-generator",
|
||||
builderID: "some/builderID@refs/heads/anybranch",
|
||||
testingEnabled: true,
|
||||
},
|
||||
{
|
||||
name: "invalid builder: ref slsa-github-generator repo: testing disabled",
|
||||
sourceURI: gitPrefix + httpsGithubCom + "slsa-framework/slsa-github-generator",
|
||||
builderID: "some/builderID@refs/heads/anybranch",
|
||||
err: serrors.ErrorInvalidRef,
|
||||
},
|
||||
{
|
||||
name: "invalid builder ref e2e repo",
|
||||
sourceURI: gitPrefix + httpsGithubCom + e2eTestRepository,
|
||||
|
||||
Reference in New Issue
Block a user