Skip to content

Commit

Permalink
Autocomplete: Escape HTML tags in callback name to avoid XSS in demo
Browse files Browse the repository at this point in the history
Fixes #15048
  • Loading branch information
scottgonzalez committed Sep 22, 2016
1 parent c571d2f commit 69e66ea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion demos/autocomplete/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,10 @@
$output = json_encode($result);

if ($_GET["callback"]) {
$output = $_GET["callback"] . "($output);";
// Escape special characters to avoid XSS attacks via direct loads of this
// page with a callback that contains HTML. This is a lot easier than validating
// the callback name.
$output = htmlspecialchars($_GET["callback"]) . "($output);";
}

echo $output;
Expand Down

0 comments on commit 69e66ea

Please sign in to comment.