Skip to content

Commit 5279a97

Browse files
authored
Update README.md
1 parent d218a4c commit 5279a97

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ You may publish the config file with:
2828
php artisan vendor:publish --tag="laravel-xss-protection-config"
2929
```
3030

31-
## Usage
31+
## Middleware Usage
3232

3333
You may use the `ProtoneMedia\LaravelXssProtection\Middleware\XssCleanInput` middleware in the route that handles the form submission.
3434

@@ -50,6 +50,24 @@ protected $middleware = [
5050
];
5151
```
5252

53+
## Configuration
54+
55+
### File uploads
56+
57+
By default, the middleware allows file uploads. You may disallow file uploads by changing the `middleware.allow_file_uploads` configuration key to `false`.
58+
59+
### Blade echo statements
60+
61+
By default, the middleware sanatizes [Blade echo statements](https://laravel.com/docs/8.x/blade#displaying-data) like `{{ $name }}`, `{{{ $name }}}`, and `{!! $name !!}`. You may allow echo statements by changing the `middleware.allow_blade_echoes` configuration key to `true`.
62+
63+
### Completely replace malicious input
64+
65+
By default, the middleware transforms malicious input to `null`. You may configure the middleware to only transform the malicious part by setting the `middleware.completely_replace_malicious_input` configuration key to `false`. That way, an input string like `hey <script>alert('laravel')</script>` will be transformed to `hey` instead of `null`.
66+
67+
### Terminate request
68+
69+
Instead of transforming malicious input, you may configure the middleware to terminate the request whenever anything malicious has been found. You may do this by setting the `middleware.terminate_request_on_malicious_input` to `true`, which will throw an HttpException with status code 403.
70+
5371
## Changelog
5472

5573
Please see [CHANGELOG](CHANGELOG.md) for more information about what has changed recently.

0 commit comments

Comments
 (0)