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 cd1d5de commit 509eb96
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,13 +567,13 @@ public function doSave($data, $form)
$this->saveFormIntoRecord($data, $form);

$link = '<a href="' . $this->Link('edit') . '">"'
. htmlspecialchars($this->record->Title ?? '', ENT_QUOTES)
. Convert::raw2xml($this->record->Title ?? '', ENT_QUOTES)
. '"</a>';
$message = _t(
'SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Saved',
'Saved {name} {link}',
[
'name' => $this->getModelName(),
'name' => Convert::raw2xml($this->getModelName()),
'link' => $link
]
);
Expand Down Expand Up @@ -834,8 +834,8 @@ public function doDelete($data, $form)
'SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Deleted',
'Deleted {type} "{name}"',
[
'type' => $this->getModelName(),
'name' => $this->record->Title
'type' => Convert::raw2xml($this->getModelName()),
'name' => Convert::raw2xml($this->record->Title)
]
);

Expand Down

0 comments on commit 509eb96

Please sign in to comment.