diff --git a/src/Appwrite/Insights/Validator/CTAs.php b/src/Appwrite/Insights/Validator/CTAs.php index 848253bc13..8f0457f33c 100644 --- a/src/Appwrite/Insights/Validator/CTAs.php +++ b/src/Appwrite/Insights/Validator/CTAs.php @@ -45,10 +45,15 @@ class CTAs extends Validator return false; } - foreach (['label', 'service', 'method'] as $required) { + $maxLengths = ['label' => 256, 'service' => 64, 'method' => 64]; + foreach ($maxLengths as $required => $maxLength) { if (!isset($entry[$required]) || !\is_string($entry[$required]) || $entry[$required] === '') { return false; } + if (\strlen($entry[$required]) > $maxLength) { + $this->message = "CTA `{$required}` must not exceed {$maxLength} characters."; + return false; + } } if (isset($entry['params']) && !\is_array($entry['params']) && !\is_object($entry['params'])) {