Below is my url with request
Cross site scripting is happening for this URL as below. New parameter is added in the URL as '-alert-'=1 and passed to nextpage
How can i stop the cross site scripting if new parameter is added
Below is my url with request
Cross site scripting is happening for this URL as below. New parameter is added in the URL as '-alert-'=1 and passed to nextpage
How can i stop the cross site scripting if new parameter is added
You can use this class as middleware
class XSSProtection
{
/**
* The following method loops through all request input and strips out all tags from
* the request. This to ensure that users are unable to set ANY HTML within the form
* submissions, but also cleans up input.
*
* @param Request $request
* @param callable $next
* @return mixed
*/
public function handle(Request $request, \Closure $next)
{
if (!in_array(strtolower($request->method()), ['put', 'post'])) {
return $next($request);
}
$input = $request->all();
array_walk_recursive($input, function(&$input) {
$input = strip_tags($input);
});
$request->merge($input);
return $next($request);
}
}
REF : https://gist.github.com/kirkbushell/5d40fdd7f7b364716742