Skip to content

Commit 0ec5a34

Browse files
Potential fix for code scanning alert no. 45: Potentially unsafe quoting
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 25bbbc8 commit 0ec5a34

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

schema/json/parser/parser_object.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"regexp/syntax"
1111
"sort"
1212
"strings"
13+
"strconv"
1314
)
1415

1516
func (p *Parser) parseObject(data interface{}, s *schema.Schema, evaluated map[string]bool) (*sortedmap.LinkedHashMap[string, interface{}], error) {
@@ -386,7 +387,7 @@ func (p *Parser) ValidatePatternProperty(name string, value interface{}, pattern
386387
msg = err.Error()
387388
}
388389
return false, &ErrorDetail{
389-
Message: fmt.Sprintf("validate string '%s' with regex pattern '%s' failed: error parsing regex: %s", name, pattern, msg),
390+
Message: fmt.Sprintf("validate string %s with regex pattern '%s' failed: error parsing regex: %s", strconv.Quote(name), pattern, msg),
390391
Field: pattern,
391392
}
392393
}

0 commit comments

Comments
 (0)