From b2a3a9384bee56ad5303bd4900f7d51292436d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Jerman?= Date: Mon, 23 Aug 2021 10:13:53 +0200 Subject: [PATCH] Add missing handle validation to templates --- system/service/template.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/system/service/template.go b/system/service/template.go index 4c508338d..169d6dc81 100644 --- a/system/service/template.go +++ b/system/service/template.go @@ -196,6 +196,10 @@ func (svc template) Create(ctx context.Context, new *types.Template) (tpl *types ) err = func() (err error) { + if !handle.IsValid(new.Handle) { + return TemplateErrInvalidHandle() + } + if !svc.ac.CanCreateTemplate(ctx) { return TemplateErrNotAllowedToCreate() } @@ -232,6 +236,10 @@ func (svc template) Update(ctx context.Context, upd *types.Template) (tpl *types return TemplateErrInvalidID() } + if !handle.IsValid(upd.Handle) { + return TemplateErrInvalidHandle() + } + if tpl, err = store.LookupTemplateByID(ctx, svc.store, upd.ID); err != nil { return }