bshaffer / oauth2-server-php

A library for implementing an OAuth2 Server in php
http://bshaffer.github.io/oauth2-server-php-docs
MIT License
3.26k stars 950 forks source link

Scope existance isn't checked in AuthorizeController::validateAuthorizeRequest #1001

Open Bhoft opened 3 years ago

Bhoft commented 3 years ago

The client scope in the AuthorizeController::validateAuthorizeRequest isn't checked if it exists in the given storage.

https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Controller/AuthorizeController.php#L307-L315

https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Scope.php#L48-L54

The requested scope is only checked if it exists if the clientScope is empty. But if both client and requested scopes are set and equal, it isn't checked if the scopes are existing in the storage at all.

Is this in intentionally as the scope which is set in the clients entries should exists in the scope storage?

I just wonder because when some scope is removed from the storage the clients with that scope are still working. I would assume that this would return also an invalid_scope error.