diff --git a/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go b/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go index 62690efb7c..2fdbb08e25 100644 --- a/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go +++ b/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go @@ -118,11 +118,15 @@ func buildConfig(ctx context.Context, pro *objects.PipelineRunObjectV1Beta1) Bui } steps := []attest.StepAttestation{} + if tr.Status.TaskSpec == nil || tr.Status.Steps == nil { + logger.Errorf("Nil TaskSpec or Steps in task run %s", tr.Name) + continue // Skip this task run if any part is nil + } // tr.Status.TaskSpec.Steps and tr.Status.Steps should be sime size - if tr.Status.TaskSpec == nil || len(tr.Status.TaskSpec.Steps) != len(tr.Status.Steps) { + if len(tr.Status.TaskSpec.Steps) != len(tr.Status.Steps) { logger.Errorf("Mismatch in number of steps for task run %s. TaskSpec steps: %d, Status steps: %d", tr.Name, len(tr.Status.TaskSpec.Steps), len(tr.Status.Steps)) - continue // Skip this task run entirely + continue } // Validate and process steps