Update Security.php to solve XSS issues from 2.1.4

pulled from development branch.