devtoolboxuk/soteria

Security Package for PHP

2.1.11 2019-10-08 11:27 UTC

This package is auto-updated.

Last update: 2024-11-08 23:34:28 UTC


README

Build Status Scrutinizer Code Quality Coveralls CodeCov

Latest Stable Version Total Downloads License

Table of Contents

Background

Various security libraries rolled into one place.

The XSS cleaner is a port from https://github.com/voku/anti-xss with the ability for it to work on some older systems.

When I get around to upgrading my legacy systems, the XSS cleaner will be updated to use voku/anti-xss directly (because it's awesome)

I've also added a URL decoder, as I found some items causing a few issues with invisible characters such as \r\n (in a URL, you probably wouldn't want this)

Usage

$ composer require devtoolboxuk/soteria

Then include Composer's generated vendor/autoload.php to enable autoloading:

require 'vendor/autoload.php';
use devtoolboxuk\soteria;

$this->security = new SoteriaService();

XSS

$xss = $this->security->xss();

XSS Clean

Great for clearing out data in posted data

#$data can be either a string or an array
$xss->clean($data); //Outputs data that has had XSS data removed.

XSS Detected

$xss->clean($data);
$xss->isXssFound(); //Returns true / false

XSS Clean a URL

Great for clearing out crappy URLs (does the same as clean, but also removes invisible characters like \r \n)

#$data can be either a string or an array
$xss->cleanUrl($data); //Outputs data that has had XSS data removed.

XSS Detected

$xss->cleanUrl($data);
$xss->isXssFound(); //Returns true / false

Filter

$filter = $this->security->filter();

Filter Email

$filter->email('test@local.com');

Filter Was an invalid email address used

$filter->email('test@local.com');
$filter->isValid(); //Returns true / false

Maintainers

@DevToolboxUk.

License

MIT © DevToolboxUK