Skip to content

Commit ece1d4b

Browse files
authored
Handle nil policies (#242)
This commit fixes a regression evaluating repositories without a policy. Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
1 parent 72a7107 commit ece1d4b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sourcetool/pkg/policy/policy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ func (pe *PolicyEvaluator) EvaluateControl(ctx context.Context, repo *models.Rep
518518
// We want to check to ensure the repo hasn't enabled/disabled the rules since
519519
// setting the 'since' field in their policy.
520520
rp, policyPath, err := pe.GetPolicy(ctx, repo)
521-
if err != nil || rp == nil {
521+
if err != nil {
522522
return slsa.SourceVerifiedLevels{}, "", err
523523
}
524524

@@ -543,7 +543,7 @@ func (pe *PolicyEvaluator) EvaluateControl(ctx context.Context, repo *models.Rep
543543
// Evaluates the provenance against the policy and returns the resulting source level and policy path
544544
func (pe *PolicyEvaluator) EvaluateSourceProv(ctx context.Context, repo *models.Repository, branch *models.Branch, prov *spb.Statement) (slsa.SourceVerifiedLevels, string, error) {
545545
rp, policyPath, err := pe.GetPolicy(ctx, repo)
546-
if err != nil || rp == nil {
546+
if err != nil {
547547
return slsa.SourceVerifiedLevels{}, "", fmt.Errorf("getting policy: %w", err)
548548
}
549549

0 commit comments

Comments
 (0)