mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Disallow <! in <script>
Summary: HTML5 has this crazy script escaping states: - Script data escaped dash dash state - Script data double escaped state https://communities.coverity.com/blogs/security/2012/11/16/did-i-do-that-html-5-js-escapers-3 Perhaps `<!` is too aggressive but I didn't spend much time searching for a more fine grained expression. Test Plan: Searched for `renderInlineScript()`. Reviewers: epriestley Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7329
This commit is contained in:
parent
d34143c723
commit
29391a658e
3 changed files with 6 additions and 0 deletions
|
@ -51,6 +51,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
$diff_vs = $request->getInt('vs');
|
||||
|
||||
$target_id = $request->getInt('id');
|
||||
phlog($target_id);
|
||||
$target = idx($diffs, $target_id, end($diffs));
|
||||
|
||||
$target_manual = $target;
|
||||
|
|
|
@ -89,6 +89,8 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
|
|||
$new = null;
|
||||
}
|
||||
|
||||
phlog($this->selectedVersusDiffID, $this->selectedDiffID);
|
||||
|
||||
if ($max_id != $id) {
|
||||
$uniq = celerity_generate_unique_node_id();
|
||||
$old_checked = ($this->selectedVersusDiffID == $id);
|
||||
|
|
|
@ -193,6 +193,9 @@ final class CelerityStaticResourceResponse {
|
|||
throw new Exception(
|
||||
'Literal </script> is not allowed inside inline script.');
|
||||
}
|
||||
if (strpos($data, '<!') !== false) {
|
||||
throw new Exception('Literal <! is not allowed inside inline script.');
|
||||
}
|
||||
return hsprintf(
|
||||
// We don't use <![CDATA[ ]]> because it is ignored by HTML parsers. We
|
||||
// would need to send the document with XHTML content type.
|
||||
|
|
Loading…
Reference in a new issue