From f5e889ec3f2aba81dc16eb5bf92605b08a368f4c Mon Sep 17 00:00:00 2001 From: ewezy Date: Mon, 19 Sep 2022 00:04:26 +0800 Subject: [PATCH] Add route name path regex to schema checks --- ui/src/router/components/form/validation/schema.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/src/router/components/form/validation/schema.js b/ui/src/router/components/form/validation/schema.js index 697019f85..f5620703f 100644 --- a/ui/src/router/components/form/validation/schema.js +++ b/ui/src/router/components/form/validation/schema.js @@ -92,7 +92,8 @@ const routerNameRegex = /^[a-z0-9-]*$/, kafkaBrokersRegex = /^([a-z]+:\/\/)?\[?([0-9a-zA-Z\-%._:]*)\]?:([0-9]+)(,([a-z]+:\/\/)?\[?([0-9a-zA-Z\-%._:]*)\]?:([0-9]+))*$/i, kafkaTopicRegex = /^[A-Za-z0-9_.-]{1,249}/i, - trafficRuleNameRegex = /^[A-Za-z\d][\w\d \-()#$%&:.]*[\w\d\-()#$%&:.]$/; + trafficRuleNameRegex = /^[A-Za-z\d][\w\d \-()#$%&:.]*[\w\d\-()#$%&:.]$/, + routeNamePathRegex = /^[\w\-]*(?:\.[\w\-]+)*$/; const timeoutSchema = yup .string() @@ -249,6 +250,7 @@ const mappingSchema = yup.object().shape({ const standardEnsemblerConfigSchema = yup.object().shape({ experiment_mappings: yup.array(mappingSchema), + route_name_path: yup.string().matches(routeNamePathRegex, "Route name path needs to be a valid period-delimited path"), fallback_response_route_id: validRouteSchema, });