Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Fix bearer token format validation #417

Merged

Conversation

krasucki
Copy link
Contributor

This fixes validation for bearer tokens that contain model id (1|xxxxxxxx..).
If you alter this id, then server will return 500 error, because there is no format validation (yes, there is some validation regarding token expiration, and presence of the token at all, but that's not enough).

How to recreate

Just alter the id param for bearer token. Make it something not a valid integer.
This results 500 Server error response for any Sanctum-protected api endpoint.

(mssql server specific, but I think this can be DB-agnostic):

SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Error converting data type nvarchar to bigint. (SQL: select top 1 * from [personal_access_tokens] where [personal_access_tokens].[id] = 1ABC

Expected value

401 Unauthorized HTTP status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants