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

fix: Use case insensitive check when validating login name #50989

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

enjeck
Copy link

@enjeck enjeck commented Feb 24, 2025

Summary

Use case insensitive check when validating login name

TODO

Checklist

Signed-off-by: Cleopatra Enjeck M. <patrathewhiz@gmail.com>
@@ -780,7 +780,7 @@ private function validateToken($token, $user = null) {
* Check if login names match
*/
private function validateTokenLoginName(?string $loginName, IToken $token): bool {
if ($token->getLoginName() !== $loginName) {
if (strtolower($token->getLoginName() ?? '') !== strtolower($loginName ?? '')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IToken::getLoginName can never be null.

Suggested change
if (strtolower($token->getLoginName() ?? '') !== strtolower($loginName ?? '')) {
if (strtolower($token->getLoginName()) !== strtolower($loginName ?? '')) {

Probably simpler with:

Suggested change
if (strtolower($token->getLoginName() ?? '') !== strtolower($loginName ?? '')) {
if (strcasecmp($token->getLoginName(), $loginName ?? '') !== 0) {

@susnux susnux added the 3. to review Waiting for reviews label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Case sensitive generation of app tokens not based on stored usernames
2 participants