Skip to content

Invalid page and filter params aren't validated #58

@LavaToaster

Description

@LavaToaster

If you decide to add in a non-spec parameter to the request such as page=2, the application errors out. This should be handled and result in a 400 Bad Request instead.

The affected parameters I'm aware of are:

  • page
  • filter

This is the from the error log:

[2015-08-05 13:50:57] local.ERROR: exception 'ErrorException' with message 'Argument 6 passed to Neomerx\JsonApi\Factories\Factory::createParameters() must be of the type array, string given, called in /home/vagrant/www/work/lyf/vendor/neomerx/json-api/src/Parameters/ParametersParser.php on line 100 and defined' in /home/vagrant/www/work/lyf/vendor/neomerx/json-api/src/Factories/Factory.php:173
Stack trace:
#0 /home/vagrant/www/work/lyf/vendor/neomerx/json-api/src/Factories/Factory.php(173): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(4096, 'Argument 6 pass...', '/home/vagrant/w...', 173, Array)
#1 /home/vagrant/www/work/lyf/vendor/neomerx/json-api/src/Parameters/ParametersParser.php(100): Neomerx\JsonApi\Factories\Factory->createParameters(Object(Neomerx\JsonApi\Parameters\Headers\Header), Object(Neomerx\JsonApi\Parameters\Headers\AcceptHeader), NULL, NULL, NULL, '2', NULL, NULL)
#2 /home/vagrant/www/work/lyf/vendor/neomerx/limoncello/src/Http/JsonApiTrait.php(305): Neomerx\JsonApi\Parameters\ParametersParser->parse(Object(Lyf\Http\Controllers\JsonApi\LaravelIntegration), Object(Neomerx\Limoncello\Errors\ExceptionThrower))
#3 /home/vagrant/www/work/lyf/vendor/neomerx/limoncello/src/Http/JsonApiTrait.php(316): Lyf\Http\Controllers\JsonApi\JsonApiController->getUncheckedParameters()
#4 /home/vagrant/www/work/lyf/vendor/neomerx/limoncello/src/Http/JsonApiTrait.php(334): Lyf\Http\Controllers\JsonApi\JsonApiController->checkParameters()
#5 /home/vagrant/www/work/lyf/vendor/neomerx/limoncello/src/Http/JsonApiTrait.php(398): Lyf\Http\Controllers\JsonApi\JsonApiController->getParameters()
#6 /home/vagrant/www/work/lyf/app/Http/Controllers/JsonApi/JsonApiController.php(46): Lyf\Http\Controllers\JsonApi\JsonApiController->getContentResponse(Array, 200, NULL, NULL)
#7 /home/vagrant/www/work/lyf/app/Http/Controllers/Api/UsersController.php(31): Lyf\Http\Controllers\JsonApi\JsonApiController->getResponse(Object(Illuminate\Database\Eloquent\Collection))
#8 [internal function]: Lyf\Http\Controllers\Api\UsersController->index()

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions