Skip to content

Commit

Permalink
Always validate element title lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Dec 27, 2024
1 parent c08010c commit 4827b24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fixed a bug where asset edit page URLs contained spaces if the asset filename contained spaces. ([#15236](https://github.com/craftcms/cms/issues/15236))
- Fixed a bug where custom fields were getting included in rendered field layout forms, even if their `getInputHtml()` method returned an empty string.
- Fixed a bug where the password input on the Set Password page wasn’t including the “Show” button.
- Fixed a SQL error that could occur if an element was saved with a title longer than 255 characters.
- Fixed an RCE vulnerability.

## 4.13.7 - 2024-12-17
Expand Down
4 changes: 2 additions & 2 deletions src/base/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -2447,8 +2447,8 @@ protected function defineRules(): array
$rules[] = [['isFresh'], BooleanValidator::class];

if (static::hasTitles()) {
$rules[] = [['title'], 'trim', 'on' => [self::SCENARIO_DEFAULT, self::SCENARIO_LIVE]];
$rules[] = [['title'], StringValidator::class, 'max' => 255, 'disallowMb4' => true, 'on' => [self::SCENARIO_DEFAULT, self::SCENARIO_LIVE]];
$rules[] = [['title'], 'trim'];
$rules[] = [['title'], StringValidator::class, 'max' => 255, 'disallowMb4' => true];
$rules[] = [['title'], 'required', 'on' => [self::SCENARIO_DEFAULT, self::SCENARIO_LIVE]];
}

Expand Down

0 comments on commit 4827b24

Please sign in to comment.