From b345cdb0faf5aa56a6472de75d2f5a93cbdeefad Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Mon, 28 Oct 2024 15:31:58 -0400 Subject: [PATCH] gocryptox509: fix schema.go (#352) --- harness/gocryptox509/schema.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/harness/gocryptox509/schema.go b/harness/gocryptox509/schema.go index 11f9b60a..5eedffca 100644 --- a/harness/gocryptox509/schema.go +++ b/harness/gocryptox509/schema.go @@ -5,6 +5,7 @@ package main import "encoding/json" import "fmt" import "reflect" +import "regexp" type ExpectedResult string @@ -522,6 +523,9 @@ func (j *Testcase) UnmarshalJSON(b []byte) error { if v, ok := raw["features"]; !ok || v == nil { plain.Features = []Feature{} } + if matched, _ := regexp.MatchString("^([A-Za-z][A-Za-z0-9-.]+::)*([A-Za-z][A-Za-z0-9-.]+)$", string(plain.Id)); !matched { + return fmt.Errorf("field %s pattern match: must match %s", "^([A-Za-z][A-Za-z0-9-.]+::)*([A-Za-z][A-Za-z0-9-.]+)$", "Id") + } if v, ok := raw["importance"]; !ok || v == nil { plain.Importance = "undetermined" }