-
Notifications
You must be signed in to change notification settings - Fork 141
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
Allow the user to list and see themselves even without rbac_user_show #1230
Conversation
837c7ec
to
d4411de
Compare
@Fryguy I'm getting this error now in the ui |
Did you switch groups? Curious how you got into that state. |
yes I was using a user with multiple groups and swapped to admin before hitting the error |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
Ok, this is the weird part. I'm finding this only works for some roles but not others, and I can't narrow it down. This causes the current code to only partially work. Looking into this deeper. |
I was expecting to see Not for now: Wondering what would happen if we used rbac for index/show and only had privs on post/update |
d4411de
to
3a5695e
Compare
3a5695e
to
b695962
Compare
Checked commit Fryguy@b695962 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint |
Backported to
|
Allow the user to list and see themselves even without rbac_user_show (cherry picked from commit cc89506)
Depends on
@jrafanie @DavidResende0 Please review.
WIP because I think this should get a lot of testing and verification. I'd like to add specs as well.I would feel more comfortable adding specs around this and extra testing because technically this fix bypasses API RBAC which is a security vector, however, bypassing API RBAC in this specific case is warranted, because a user should be able to see themselves.
Note that user
update
was already written to bypass API RBAC for yourself because that's how the group switcher works, but for some reason index and show were not included in the list for API RBAC bypass.Interestingly when you RBAC.filter the users list it automatically allows you to see yourself - I didn't have to add any special code for index - RBAC.filter just took care of it.
Admin user
Admin user - index
Before & After
curl -s --user admin:smartvm -X GET -H "Accept: application/json" http://localhost:3000/api/users | jq .
Admin user - show self
Before & After
curl -s --user admin:smartvm -X GET -H "Accept: application/json" http://localhost:3000/api/users/1 | jq .
Admin user - show other
Before & After
curl -s --user admin:smartvm -X GET -H "Accept: application/json" http://localhost:3000/api/users/2 | jq .
Non-Admin user
Non-Admin user - index
Before
curl -s --user non-admin:smartvm -X GET -H "Accept: application/json" http://localhost:3000/api/users | jq .
After
curl -s --user non-admin:smartvm -X GET -H "Accept: application/json" http://localhost:3000/api/users | jq .
Non-Admin user - show self
Before
curl -s --user non-admin:smartvm -X GET -H "Accept: application/json" http://localhost:3000/api/users/2 | jq .
After
curl -s --user non-admin:smartvm -X GET -H "Accept: application/json" http://localhost:3000/api/users/2 | jq .
Non-Admin user - show other
Before
curl -s --user non-admin:smartvm -X GET -H "Accept: application/json" http://localhost:3000/api/users/1 | jq .
After
curl -s --user non-admin:smartvm -X GET -H "Accept: application/json" http://localhost:3000/api/users/1 | jq .