shieldon / web-security
XSS protection for PHP.
Installs: 19 149
Dependents: 2
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: >=7.1.0
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-12-22 17:51:10 UTC
README
This package is a part of Shieldon Firewall 2.
Installation
Use PHP Composer:
composer require shieldon/web-security
Or, download it and include the Shieldon autoloader.
require 'autoload.php';
Usage
Clean single variable
$xss = new \Shieldon\Security\Xss(); $_POST['username'] = 'javascript:/*--></title></style></textarea></script></xmp><svg/onload=\'+/"/+/onmouseover=1/+/[*/[]/+alert(1)//\'>'; $username = $xss->clean($_POST['username']); echo $username;
result
[removed]/*--></title></style></textarea>[removed]</xmp><svg/[removed]>
Clean a superglobal
$xss = new \Shieldon\Security\Xss(); $_GET = $xss->clean($_GET);
Author
License
MIT