Handle sanitization as early as possible per best practices
Per WP security best practices, sanitization should be handled as early as possible. So this commit move updates the calls to sanitize the segment name and description to the part of the code where the user input is first processed, instead of when the data is saved to the database. [MAILPOET-5232]
This commit is contained in:
@ -105,6 +105,8 @@ class DynamicSegments extends APIEndpoint {
|
||||
|
||||
public function save($data) {
|
||||
try {
|
||||
$data['name'] = isset($data['name']) ? sanitize_text_field($data['name']) : '';
|
||||
$data['description'] = isset($data['description']) ? sanitize_textarea_field($data['description']) : '';
|
||||
$segment = $this->saveController->save($data);
|
||||
return $this->successResponse($this->segmentsResponseBuilder->build($segment));
|
||||
} catch (InvalidFilterException $e) {
|
||||
|
Reference in New Issue
Block a user