From e1179d960fa9cf2538f0407f2e52c6f26cb2c16c Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 5 Oct 2024 02:18:45 +0100 Subject: [PATCH] Validate against non-alphanumeric characters in keys, in TDFs --- .../Services/ValidationService.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php b/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php index 95f6ea82..bf9711a5 100644 --- a/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php +++ b/build/scripts/Targets/TargetDescriptionFiles/Services/ValidationService.php @@ -1113,12 +1113,9 @@ class ValidationService $failures[] = 'Key must contain only lowercase characters'; } - if (str_contains($key, ' ')) { - $failures[] = 'Key contains at least one whitespace'; - } - - if (str_contains($key, '.')) { - $failures[] = 'Key contains at least one period (".") character'; + // The underscore character is the only non-alphanumeric character that is permitted in keys + if (!ctype_alnum(str_replace('_', '', $key))) { + $failures[] = 'Key contains non-alphanumeric characters'; } return array_map(