diff --git a/clients/go/zms/zms_schema.go b/clients/go/zms/zms_schema.go index 26fdf544434..53a39eadc2d 100644 --- a/clients/go/zms/zms_schema.go +++ b/clients/go/zms/zms_schema.go @@ -111,12 +111,12 @@ func init() { tTagValue := rdl.NewStringTypeBuilder("TagValue") tTagValue.Comment("TagValue to contain generic string patterns") - tTagValue.Pattern("[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*") + tTagValue.Pattern("[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*") sb.AddType(tTagValue.Build()) tTagCompoundValue := rdl.NewStringTypeBuilder("TagCompoundValue") tTagCompoundValue.Comment("A compound value of TagValue") - tTagCompoundValue.Pattern("([a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*\\.)*[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*") + tTagCompoundValue.Pattern("([a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*\\.)*[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*") sb.AddType(tTagCompoundValue.Build()) tTagValueList := rdl.NewStructTypeBuilder("Struct", "TagValueList") diff --git a/core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java b/core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java index 0290a7dbb72..a9931d412d7 100644 --- a/core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java +++ b/core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java @@ -94,11 +94,11 @@ private static Schema build() { sb.stringType("TagValue") .comment("TagValue to contain generic string patterns") - .pattern("[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*"); + .pattern("[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*"); sb.stringType("TagCompoundValue") .comment("A compound value of TagValue") - .pattern("([a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*\\.)*[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*"); + .pattern("([a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*\\.)*[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*"); sb.structType("TagValueList") .arrayField("list", "TagCompoundValue", false, "list of tag values"); diff --git a/core/zms/src/main/rdl/Names.tdl b/core/zms/src/main/rdl/Names.tdl index df12a1164f0..70f81c7ab99 100644 --- a/core/zms/src/main/rdl/Names.tdl +++ b/core/zms/src/main/rdl/Names.tdl @@ -73,7 +73,7 @@ type AuthorityKeywords String (pattern="({AuthorityKeyword},)*{AuthorityKeyword} type TagKey String (pattern="({SimpleName}[:\\.])*{SimpleName}"); //TagValue to contain generic string patterns -type TagValue String (pattern="[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*"); +type TagValue String (pattern="[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*"); //A compound value of TagValue type TagCompoundValue String (pattern="({TagValue}\\.)*{TagValue}"); diff --git a/core/zms/src/test/java/com/yahoo/athenz/zms/ZMSCoreTest.java b/core/zms/src/test/java/com/yahoo/athenz/zms/ZMSCoreTest.java index e95443cfc94..57a9769bccb 100644 --- a/core/zms/src/test/java/com/yahoo/athenz/zms/ZMSCoreTest.java +++ b/core/zms/src/test/java/com/yahoo/athenz/zms/ZMSCoreTest.java @@ -2707,6 +2707,10 @@ public void testTagValueList() { tvl = new TagValueList().setList(Collections.singletonList("/homes/home/")); resultTvl = validator.validate(tvl, "TagValueList"); assertTrue(resultTvl.valid); + + tvl = new TagValueList().setList(Collections.singletonList("/home%test")); + resultTvl = validator.validate(tvl, "TagValueList"); + assertTrue(resultTvl.valid); } private UserAuthorityAttributeMap getUserAuthorityAttributeMapForTest() {