From b487c3dcf439722f95f713816b1e77c5ee6cb6d0 Mon Sep 17 00:00:00 2001 From: Jawed khelil Date: Thu, 31 Oct 2024 10:03:09 +0100 Subject: [PATCH] fix nil pointer dereference when taksrun is canceled --- pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go b/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go index 7329a615d4..62690efb7c 100644 --- a/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go +++ b/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go @@ -119,7 +119,7 @@ func buildConfig(ctx context.Context, pro *objects.PipelineRunObjectV1Beta1) Bui steps := []attest.StepAttestation{} // tr.Status.TaskSpec.Steps and tr.Status.Steps should be sime size - if len(tr.Status.TaskSpec.Steps) != len(tr.Status.Steps) { + if tr.Status.TaskSpec == nil || 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