Skip to content

Commit

Permalink
FIX Escape user input from an HTML context.
Browse files Browse the repository at this point in the history
There is no XSS vulnerability here due to other measures to mitigate one
- but user input which includes HTML characters still might not render
  correctly without this fix.
  • Loading branch information
GuySartorelli committed Jan 14, 2025
1 parent 64b0c33 commit 8cff343
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/Extension/Traits/FluentAdminTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Core\Convert;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\Forms\FormAction;
Expand Down Expand Up @@ -258,7 +259,7 @@ public function clearFluent($data, $form)
$message = _t(
'TractorCow\Fluent\Extension\Traits\FluentAdminTrait.ClearAllNotice',
"All localisations have been cleared for '{title}'.",
['title' => $record->Title]
['title' => Convert::raw2xml($record->Title)]
);

$record->flushCache(true);
Expand Down Expand Up @@ -304,7 +305,7 @@ public function copyFluent($data, $form)
$message = _t(
'TractorCow\Fluent\Extension\Traits\FluentAdminTrait.CopyNotice',
"Copied '{title}' to all other locales.",
['title' => $record->Title]
['title' => Convert::raw2xml($record->Title)]
);

$record->flushCache(true);
Expand Down Expand Up @@ -338,7 +339,7 @@ public function unpublishFluent($data, $form)
$message = _t(
'TractorCow\Fluent\Extension\Traits\FluentAdminTrait.UnpublishNotice',
"Unpublished '{title}' from all locales.",
['title' => $record->Title]
['title' => Convert::raw2xml($record->Title)]
);

$record->flushCache(true);
Expand Down Expand Up @@ -388,7 +389,7 @@ public function archiveFluent($data, $form)
$message = _t(
'TractorCow\Fluent\Extension\Traits\FluentAdminTrait.ArchiveNotice',
"Archived '{title}' and all of its localisations.",
['title' => $record->Title]
['title' => Convert::raw2xml($record->Title)]
);

$record->flushCache(true);
Expand Down Expand Up @@ -436,7 +437,7 @@ public function deleteFluent($data, $form)
$message = _t(
'TractorCow\Fluent\Extension\Traits\FluentAdminTrait.DeleteNotice',
"Deleted '{title}' and all of its localisations.",
['title' => $record->Title]
['title' => Convert::raw2xml($record->Title)]
);

$record->flushCache(true);
Expand Down Expand Up @@ -480,7 +481,7 @@ public function publishFluent($data, $form)
$message = _t(
'TractorCow\Fluent\Extension\Traits\FluentAdminTrait.PublishNotice',
"Published '{title}' across all locales.",
['title' => $record->Title]
['title' => Convert::raw2xml($record->Title)]
);

$record->flushCache(true);
Expand Down Expand Up @@ -511,8 +512,8 @@ public function showFluent($data, $form)
'TractorCow\Fluent\Extension\Traits\FluentAdminTrait.ShowNotice',
"Record '{title}' is now visible in {locale}",
[
'title' => $record->Title,
'locale' => $locale->Title
'title' => Convert::raw2xml($record->Title),
'locale' => Convert::raw2xml($locale->Title),
]
);

Expand Down Expand Up @@ -544,8 +545,8 @@ public function hideFluent($data, $form)
'TractorCow\Fluent\Extension\Traits\FluentAdminTrait.HideNotice',
"Record '{title}' is now hidden in {locale}",
[
'title' => $record->Title,
'locale' => $locale->Title
'title' => Convert::raw2xml($record->Title),
'locale' => Convert::raw2xml($locale->Title),
]
);

Expand Down

0 comments on commit 8cff343

Please sign in to comment.