From d07fccceaa7e928015ef18ca9d8595ae84a7b61c Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Thu, 7 Jul 2022 16:43:26 -0600 Subject: [PATCH] Adding additional template context key collision checking --- validate/template.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/validate/template.go b/validate/template.go index 4338257..4c9c40d 100644 --- a/validate/template.go +++ b/validate/template.go @@ -57,12 +57,15 @@ func (t *Template) tmplPayload(c echo.Context, data Map) (Map, error) { } // Now static variables for k, v := range t.staticMap { + if _, ok := input[k]; ok { + return nil, fmt.Errorf("Template context conflict (static data). Reserved key: %v", k) + } input[k] = v } if data != nil { for k, v := range data { if _, ok := input[k]; ok { - return nil, fmt.Errorf("Template context conflict. Reserved key: %v", k) + return nil, fmt.Errorf("Template context conflict (handler data). Reserved key: %v", k) } input[k] = v } -- 2.45.2