From 6c61a86153bc4f0b3b5273575723f53b58ce25ed Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Tue, 16 Jun 2026 09:27:08 +0300 Subject: [PATCH] Fix extra specs nil pointer deref When pools have extra specs set explicitly to `null`, the variable we unmarshal into, if the type is nullable, will become null. In this case a ma[string]any{}, even if it was previously initialized to a non-null value, will become null. Any attempt to assign it it will cause a panic. Guard against that case. Signed-off-by: Gabriel Adrian Samfira --- runner/pool/pool.go | 2 +- util/util.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/runner/pool/pool.go b/runner/pool/pool.go index 9f5fc1972..b9414bef3 100644 --- a/runner/pool/pool.go +++ b/runner/pool/pool.go @@ -270,7 +270,7 @@ func (r *basePoolManager) persistJobToDB(ctx context.Context, jobParams params.J "is_new_job", isNewJob, "job_action", jobParams.Action, ) - return fmt.Errorf("job %d should not be recorded", jobParams.WorkflowJobID) + return fmt.Errorf("job %d should not be recorded: %w", jobParams.WorkflowJobID, runnerErrors.ErrUnprocessable) } slog.DebugContext( diff --git a/util/util.go b/util/util.go index f07859e5c..374313a13 100644 --- a/util/util.go +++ b/util/util.go @@ -139,6 +139,12 @@ func MaybeAddWrapperToExtraSpecs(ctx context.Context, param commonParams.Bootstr return param } } + if data == nil { + // Unmarshal returned nil. An explicit `null` was probably passed. + // Any other valid json would either fail to unmarshal or unmarshal + // into an actual map we can use. + return param + } if _, ok := data["runner_install_template"]; ok { // User has already set a runner install template override. Do not touch.