An improper authorization issue exists in the `ScopeRepository::finalizeScopes()` function. This occurs because the `ScopeEntity::containsScope()` function ignores registered permissions, allowing read-only SMART/OAuth clients to obtain write scopes. An attacker with a client registered for `user/<resource>.read` can request `user/<resource>.write` to create, update, and delete patient data or appointments.