Skip to content

Commit

Permalink
Merge pull request #2 from dmt-software/2.0
Browse files Browse the repository at this point in the history
2.0
  • Loading branch information
proggeler committed Feb 22, 2023
2 parents 8f4709d + cabff61 commit c94d74b
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 3,055 deletions.
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
.idea
.phpunit.result.cache
composer.lock
composer.phar
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
/vendor
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 dmt-software
Copyright (c) 2023 dmt-software

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# anti-xss-middleware
anti-xss middleware
# Anti XSS Middleware

This middleware implements the PSR-15 MiddlewareInterface and can be helpful to prevent XSS attacks.

## Installation

```bash
composer install dmt-software/anti-xss-middleware
```

## Usage

```php
use DMT\Http\AntiXss\Middleware\AntiXssMiddleware;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

/** @var ResponseFactoryInterface $responseFactory */
$antiXssMiddleware = new AntiXssMiddleware($responseFactory);

/** @var ServerRequestInterface $request */
/** @var RequestHandlerInterface $handler */
$response = $antiXssMiddleware->process($request, $handler);

if ($response->getStatusCode() === 400) {
// cross site scripting detected
}
```
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
{
"name": "dmt-software/anti-xss-middleware",
"description": "anti-xss middleware",
"description": "PSR-15 middleware to help prevent xss attacks",
"minimum-stability": "stable",
"license": "mit",
"license": "MIT",
"authors": [
{
"name": "lingo",
"email": "lingo@de-mes.nl"
},
{
"name": "Bas de Mes",
"email": "bas@dmt-software.nl"
}
],
"autoload": {
"psr-4": {
"DMT\\Http\\AntiXss\\Middleware\\": "src"
"DMT\\Http\\AntiXss\\Middleware\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"DMT\\Http\\AntiXss\\Middleware\\": "test"
"DMT\\Test\\Http\\AntiXss\\Middleware\\": "test/"
}
},
"require": {
"psr/http-server-middleware": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"pavelsterba/http-exceptions": "^1.1",

"voku/anti-xss": "^4.1"
},
"require-dev": {
Expand Down
Loading

0 comments on commit c94d74b

Please sign in to comment.