2017 © Pedro Peláez
 

library ninja

A simple but very effective PHP firewall. It enables you to easily block most SQL and XSS injections. It also includes a white-/blacklisting of IP's and throttling request using Leaky Bucket.

image

ninjaphp/ninja

A simple but very effective PHP firewall. It enables you to easily block most SQL and XSS injections. It also includes a white-/blacklisting of IP's and throttling request using Leaky Bucket.

  • Thursday, July 3, 2014
  • by jeroenvisser101
  • Repository
  • 3 Watchers
  • 11 Stars
  • 337 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

What is Ninja

Ninja is a very simple firewall which you can configure to do awesome things. It's still in development, but it may already be used., (*1)

How to configure

Ninja uses Leaky Bucket for throttling requests. You can teach your Ninja about hazards, and block them where needed., (*2)

``` php <?php use \Ninja\Ninja;, (*3)

Ninja::addHazard( 'throttle', Ninja::HAZARD_TYPE_THROTTLE, function (\Symfony\Component\HttpFoundation\Request $request) { return true; }, array( 'bucket_size' => 10, 'bucket_leak' => 1 ) );, (*4)


When the hazard returns true, it means the hazard has been detected. To detect a hazard, you retrieve a Request object. You can check that for all sorts of things. Apart from the `bucket_size` and `bucket_leak` you can also specify a `timeout` for when attacks happen. You should also give your Ninja something to protect. ``` php <?php use Ninja\Ninja; // ... Request::enableHttpMethodParameterOverride(); $request = Request::createFromGlobals(); // Send the Ninjas Ninja::prepare(__DIR__ . '/../app/config/ninja.php', $request); Ninja::protect(); $response = $kernel->handle($request); // Inject the Ninja in the response Ninja::inject($response); $response->send(); $kernel->terminate($request, $response);

Legals

You can find the LICENSE file in this project., (*5)

The Versions

03/07 2014

dev-master

9999999-dev

A simple but very effective PHP firewall. It enables you to easily block most SQL and XSS injections. It also includes a white-/blacklisting of IP's and throttling request using Leaky Bucket.

  Sources   Download

MIT

The Requires

 

by Jeroen Visser

xss firewall protection sqli iptables

03/07 2014

0.1.1

0.1.1.0

A simple but very effective PHP firewall. It enables you to easily block most SQL and XSS injections. It also includes a white-/blacklisting of IP's and throttling request using Leaky Bucket.

  Sources   Download

MIT

The Requires

 

by Jeroen Visser

xss firewall protection sqli iptables

02/07 2014

0.1.0

0.1.0.0

A simple but very effective PHP firewall. It enables you to easily block most SQL and XSS injections. It also includes a white-/blacklisting of IP's and throttling request using Leaky Bucket.

  Sources   Download

MIT

The Requires

 

by Jeroen Visser

xss firewall protection sqli iptables