项目作者: willdurand

项目描述 :
JSONP callback validator.
高级语言: PHP
项目地址: git://github.com/willdurand/JsonpCallbackValidator.git
创建时间: 2013-10-17T21:14:26Z
项目社区:https://github.com/willdurand/JsonpCallbackValidator

开源协议:MIT License

下载


JsonpCallbackValidator

GitHub Actions
Total
Downloads
Latest Stable
Version

JsonpCallbackValidator allows you to validate a JSONP callback in order
to prevent XSS attacks.

Usage

  1. $validator = new \JsonpCallbackValidator();
  2. $validator->validate("JSONP.callback");
  3. // returns `true`
  4. $validator->validate("(function xss(x){evil()})");
  5. // returns `false`

Or as a static method:

  1. \JsonpCallbackValidator::validate("JSONP.callback");
  2. // returns `true`
  3. \JsonpCallbackValidator::validate("(function xss(x){evil()})");
  4. // returns `false`

Installation

The recommended way to install JsonpCallbackValidator is through
Composer:

  1. $ composer require willdurand/jsonp-callback-validator

Unit Tests

Setup the test suite using Composer:

  1. $ composer install

Run it using PHPUnit:

  1. $ ./vendor/bin/simple-phpunit

Contributing

See CONTRIBUTING file.

Credits

License

JsonpCallbackValidator is released under the MIT License. See the bundled
LICENSE file for details.