-
Notifications
You must be signed in to change notification settings - Fork 143
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
Ignore case of the userid when validating it. #396
Ignore case of the userid when validating it. #396
Conversation
@miq-bot assign @gtanzillo |
@miq-bot add_label bug |
@miq-bot add_label gaprindashvili/yes |
@h-kataria Just FYI. Thank you for the help. |
@gtanzillo I had considered using Let me know if you feel I should use: Thank you, JoeV |
@@ -75,7 +75,7 @@ def log_init(mod, name, options) | |||
end | |||
|
|||
def validate_userid(userid) | |||
raise "Invalid userid #{userid} specified" unless User.exists?(:userid => userid) | |||
raise "Invalid userid #{userid} specified" unless User.where('lower(userid) = ?', userid.downcase).exists? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jvlcek You should add the region scoping here. I think it was missed wth the original code and is a bug waiting to happen. We should only allow users that are defined in the current region to log in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gtanzillo Wildo. Thank you.
This PR makes a 1 line code change in lib/services/api/user_token_service.rb and updated However Travis builds failed for 2 specs due to PR: ManageIQ/manageiq#17550, The updates to files config/api.yml and spec/requests/service_dialogs_spec.rb were Please review. Thank you! JoeV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks ok to me but I'd like to have @abellotti give it a look before I merge.
EDIT: actually, sorry, no, this is removing features... |
@jvlcek I am okay with this, however, I'm starting to feel that I deleted an API feature by dropping those featurs 😞 so I think this is more @abellotti's call than mine. |
@romanblanco can you please verify that this doesn't break your dialog editor? |
cc0936b
to
4349932
Compare
Checked commits jvlcek/manageiq-api@2ef3d85~...4349932 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
I'm pretty sure we have this correctly updated to align with the changes to the dialogs in manageiq. @himdel @skateman @gtanzillo and @abellotti can each of you please take a quick look? Thank you! JoeV |
@skateman tested, Dialog Editor seems to work correctly 👍 |
LGTM!! Thanks @jvlcek for fixing this. 👍 |
Ignore case of the userid when validating it. (cherry picked from commit 956c0d5) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1638501
Skipped backport of spec file (which doesn't exist in G branch) as per discussion with @jvlcek Gaprindashvili backport details:
|
The authentication code ignores the case of the userid. The PR ensures the API user validation
code does also.
All userids are created by the authentication code in lowercase. Users can be manually created with the UI in mixed case. However the UI will not allow a second user to be created with a mismatching case.
If User exists and one attempts to create user the UI will report: Userid is not unique
To test:
Note: The case of the value specified for Username on the login screen is ignored. So if User was create one could log in with User or user
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1590398