Closed
Description
- Passport Version: 7.5.1 (but seems to be still present in current master)
- Laravel Version: 5.8.7 (though it should be still present with v7)
- PHP Version: 7.2.29
- Database Driver & Version: MySql 5.7
Description:
On creation or updating of a client via Laravel\Passport\Http\Controllers\ClientController
, the name
parameter is validated with a hardcoded maximum length of 255
. This length is the default for Blueprint, but it can be customized via Schema::defaultStringLength()
.
Having a customized length there might lead to crashes due to database errors, in case the customized length is smaller than 255.
Customizing that length seems to be quite common, due to index size constraints in combination with utf8mb4_unicode_ci
collation. See https://laravel.com/docs/7.x/migrations#creating-indexes in paragraph Index Lengths & MySQL / MariaDB.
Steps To Reproduce:
- Customize the
defaultStringLength
inAppServiceProvider
, for example like this:
Schema::defaultStringLength(191);
- Run initial passport migrations
- Column size in DB will not match validation size
- Try to create a new or update an existing client via ClientController, and observe the application crashing on a database error
String data, right truncated: 1406 Data too long for column 'name' at row 1