Is it safe to allow these special characters when validating a string? The user is currently allowed to send alpha numeric and the following special characters from the browser:
',.!&()_-
My main concern is code injection. I'm still learning Laravel and I understand it handles a lot security wise. I'd like to make sure I'm taking solid precautions for good security.
I have the following code which uses the PHP Laravel framework to validate on the server side:
$this->validate($request, [
'str' => 'bail|required|regex:/^[a-zA-Z0-9 \',.!&_-]+$/u'
]);
$search_str = $request->str;
$query = Story::where('story_text', 'LIKE', '%'.$search_str.'%');
Is this sufficiently secure or is there more I should be doing?