You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FormRequest::validated() returns only validated params method.
But all nested values will be returned.
If validated method returns not validated values, this cause security probrem.
Steps To Reproduce:
FormRequest
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class AdminRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'foo' => 'required',
'bar' => 'required',
'user.name' => 'required|max:255',
'user.email' => 'required|max:255|email',
];
}
}
In Controller
<?php
namespace App\Http\Controllers;
use App\Admin;
use App\Http\Requests\AdminRequest;
use App\Http\Resources\AdminResource;
use Illuminate\Contracts\Support\Responsable;
class AdminController extends Controller
{
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response|Responsable
*/
public function store(AdminRequest $request)
{
var_dump($request->validated());
}
The text was updated successfully, but these errors were encountered:
ttsuru
changed the title
FormRequest::validated() returns all params with nested params.
FormRequest::validated() returns all params in nested params.
Aug 6, 2018
Description:
FormRequest::validated() returns only validated params method.
But all nested values will be returned.
If validated method returns not validated values, this cause security probrem.
Steps To Reproduce:
FormRequest
In Controller
Request data
Return data
Expected data
The text was updated successfully, but these errors were encountered: