-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
ui: logging in with capitalized username prevent access to Databases and Statements pages #51663
Comments
@asubiotto, I like to work on this, before starting the implementation, can we change it to |
Good question. Intuitively, I think we should throw a validation error, but cc @aaron-crl who might have a more informed opinion of this. |
This is a correctness bug for auth too; if we don't accept upper-case characters in usernames in the database we should not accept and use them in the UI. I'd be opposed to silently normalizing too as this may result in user surprise when using a password manager where they've stored the uppercase username and it works on one interface but not another. On an aside it sounds like some but not all of our UI code is normalizing usernames before they are sent to the database. We should review these endpoints to ensure they are properly sanitizing input. Possibly related: #55398 |
To start, I don't think this is a project we're willing to farm out to contributors outside of our team. It needs to touch multiple areas across the product and also align with our (internal) CockroachCloud authentication strategy. Now to the specific issue, in the description at top:
This behavior would be incorrect. If the username inside the database contains capitals, then it would become impossible for that user to log in into the UI. What we need here is twofold:
In general I am not keen to looking at this issue in isolation. There should be a wider discussion. |
Last time this came up, I thought we decided that usernames should be case-insensitive (possibly for compatibility with postgres), and that all entry points should be normalizing to lowercase (see the MakeSQLUsernameFromUserInput function). The |
Ok so I think the "next action" here is to normalize the input in the login form in the UI, so that the UI does not retain a username that's not normalized for subsequent lookups in views. How does this sound? @dhartunian can you help us triage this? |
My experience just now seems related to this issue, around case sensitivity (or insensitivity) for objects in the DB. When I run Later, when I attempt to run this, it fails since this role doesn't exist (in this context, the uppercase characters are preserved): Is there any way to get around this apart from lower-casing any of these role names? |
this is a different issue. Let's file it separately. |
@mgoddard can you double check this? I just ran the following without error:
|
|
The PR that fixes this bug is #70439 specifically this part of the diff It's quite a large change which is why it wasn't backported. However, as @knz mentioned above, this is different than the original issue reported here. The DB Console still needs to normalize usernames into lower case to address this issue. |
We have marked this issue as stale because it has been inactive for |
Edit 2021-03-01 (@knz) The issue description is misguided. See comment belows by @aaron-crl and myself.
Describe the problem
When logging into the Admin UI and specifying a valid user with the admin role with the username capitalized, the Admin UI mostly works OK except the Databases and Statements pages do not work properly. Logging in using the same user with the username lower-cased does provides proper access to these pages.
To Reproduce
Login to the Admin UI using the user created above, but specifying the username capitalized --> J4
Notice the UI displays the logged in user with the capitalized name
Attempt to access the Statements page, and observe the error message.
Attempt to access the Databases page, and observe the page does not populate.
Logout. Then login using the same username, but specify the username in lower-case.
Notice the UI displays the logged in user with the lower case name.
Access the Statements and Database pages, and observe that they work properly.
Expected behavior
Admin UI should convert the username specified during login into lower-case, matching the username expected by the database.
Environment:
Build Tag: v20.1.1
Build Time: 2020/05/19 14:40:33
Distribution: CCL
Platform: darwin amd64 (x86_64-apple-darwin14)
Go Version: go1.13.9
C Compiler: 4.2.1 Compatible Clang 3.8.0 (tags/RELEASE_380/final)
Build SHA-1: 6123c0c
Build Type: release
Jira issue: CRDB-4017
Epic CRDB-32130
The text was updated successfully, but these errors were encountered: