Comments (3)
Hi @stardothosting,
Can you post your middleware and also your test?
from purify.
I have this integrated into a Laravel 8.x web application , here is the middleware :
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Stevebauman\Purify\Facades\Purify;
class XssSanitization
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
$input = $request->all();
array_walk_recursive($input, function(&$input) {
$input = Purify::clean($input);
});
$request->merge($input);
return $next($request);
}
}
And the test basically simulates a POST submission of form data and checks the database for expected results
public function test_post_submit()
{
$response = $this->actingAs($user)
->post('/controller/registration/save/first', [
'offroad' => '0',
]);
$this->assertEquals(422, $response->getStatusCode());
}
If I change the middleware to basically bypass the Purify filter if null, boolean or integer, it bypasses the problem :
$input = (is_bool($input) || is_int($input) || is_null($input) ? $input : Purify::clean($input));
from purify.
Related Issues (20)
- Request upgrade to support Laravel 6.0 HOT 1
- /vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer not writable, please chmod to 777 HOT 3
- Base directory does not exist, please create or change using %Cache.SerializerPath HOT 4
- Unable to add strike element to custom configuration HOT 1
- Request update to support Laravel 7 HOT 3
- Undefined variable: array HOT 1
- Allow different caching strategies HOT 3
- Depreciation Notice: Class HTMLPurifier_Language_en_x_test does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. HOT 1
- input tag HOT 2
- Iframe allowfullscreen not enabled HOT 3
- 'Cache.SerializerPath' does not work with Dynamic Configuration HOT 1
- It's not working as it should ? HOT 3
- Readme says - Register PurifySetupProvider in "app/config.php" - should be "config/app.php" HOT 1
- License HOT 1
- Problem table HOT 3
- oembed / CKeditor HOT 1
- Laravel 9 support HOT 5
- Vapor / Other storage drivers Support HOT 7
- Definition with HTMLPurifier_HTMLDefinition not working HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from purify.