From a3f00c5d5e73e34c0b01d86012d634ddcc631d69 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Sat, 5 Aug 2023 21:51:48 +0100 Subject: [PATCH] batch: Strict unmarshal yaml document to avoid user made typos (#17808) // UnmarshalStrict is like Unmarshal except that any fields that are found // in the data that do not have corresponding struct members, or mapping // keys that are duplicates, will result in // an error. --- cmd/batch-handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/batch-handlers.go b/cmd/batch-handlers.go index cb1df6096..04632ef9c 100644 --- a/cmd/batch-handlers.go +++ b/cmd/batch-handlers.go @@ -1565,7 +1565,7 @@ func (a adminAPIHandlers) StartBatchJob(w http.ResponseWriter, r *http.Request) } job := &BatchJobRequest{} - if err = yaml.Unmarshal(buf, job); err != nil { + if err = yaml.UnmarshalStrict(buf, job); err != nil { writeErrorResponseJSON(ctx, w, toAPIError(ctx, err), r.URL) return }