api-tools-doctrine-querybuilder allows a user to inject invalid sql into a QueryBuilder. This fix calls the collection adapter query object with getSQL() which triggers the query to parse()https://github.com/doctrine/orm/blob/master/lib/Doctrine/ORM/Query.php#L181 and throws an exception if the query is invalid. This is caught and re-thrown as a DomainException fro ApiProblem.
Unit test included which injects invalid sql to trigger custom 500 error.
Description
Fixes https://github.com/laminas-api-tools/api-tools-doctrine-querybuilder/issues/3
api-tools-doctrine-querybuilder allows a user to inject invalid sql into a QueryBuilder. This fix calls the collection adapter query object with
getSQL()
which triggers the query toparse()
https://github.com/doctrine/orm/blob/master/lib/Doctrine/ORM/Query.php#L181 and throws an exception if the query is invalid. This is caught and re-thrown as a DomainException fro ApiProblem.Unit test included which injects invalid sql to trigger custom 500 error.