-
Notifications
You must be signed in to change notification settings - Fork 107
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
Broken authentication for users in the REST module upon adding a new type of groups in CRIC #11495
Comments
@todor-ivanov , thanks for wrapping this bug into specific issue. I just want to add here that we should be very careful with changes to auth/authz logic as it is used in different places. For instance, dbs2go and auth proxy go code relies on cmsauth repo which implements similar logic for Go based applications (APS/XPS, CMSMonitoring, DBS, etc.). Therefore, I suggest to elevate this issue to all relevant parties, and include CMSWEB/CMSMonitoring/DBS groups to take similar set of actions and provide similar changes and deploy newer version with that fixes. I opened new issue in cmsauth repo, see dmwm/cmsauth#1 FYI @muhammadimranfarooqi , @mrceyhun , @arooshap, @Paparrigopoulo |
Thanks @vkuznet It is not just a new header that is added here. It is a new type of object also associated with the user. I checked the code further and it would require not only changes in the information we collect from CRIC through new headers. This change in CRIC will also imply new attributes to the user object && changes of all methods signatures and logic related to users' authentication/authorization. Yeee... what I wanted to say is - at the end it manifests to us in the form of a new HTTP header, but the story does not end just there ... |
Valya I just updated the issue description, adding a twiki page related to the CMS IAM-Based Tokens, which Panos provided for reference. |
AFAIU Panos did not expect, nor desired, the new group-type to appear as a header for the CMSWEB BackEnd services. That said, I have no strong feeling or requirement and "as long as it works" leave the matter to you. |
Thanks @belforte, this is my intention as a first step as well. |
Hi @Panos512 , I know we have briefly discussed this new type of group in MM and the relevant Jira ticket, but as Alan mentioned in his comment here, it would be good to know what are the actual plans for using this new tag/group type. Like:
The reason for asking is we'd want to know how feasible is for us to investigate on full feature development right now, or should we postpone things before everything is clear. A complete list of requirements would also be crucial for us for the process of fixing this. FYI @amaltaro |
Hello @todor-ivanov and @amaltaro First of all, I have patched the CRIC API that caused the issue [1] to only display groups with the Of course, it's very easy to enable any other tags in the future. So if we let's say decide that we want Now for the migration to tokens. There are also some slides [3] that I presented to my group but the audience was different, maybe just check slides 24-34 if you are interested. So, these groups are most probably of no interest to WMCore. This means that in any client level when a token arrives one can check the scopes it has assigned and decide what to do with it. We want to have this sync mechanism running in the next couple of weeks so that we start testing other services. I initially joined this effort to take care of the data management part so I know that we need to start testing that storage services correctly interpret tokens right after. I'm not sure what the plans of other areas are. Hope this helps :) [1] https://cms-cric.cern.ch/api/accounts/user/query/?json&preset=roles |
Thanks @Panos512 , This indeed outlines the big picture, and plus, provides the sources and all details needed for people who want to dive in deeper. It was also good to see your plans and where things are heading at the moment. And also thanks for hiding the new group tag for WMCore and other services using the legacy APIs. So to resume (please correct me if I am wrong) - In the current situation, those activities and tests would be accomplished mostly by data and grid resource management groups and eventually some other teams who are willing to jump early. But as it comes to WMCore, we are in a safe position to sit and decide how to approach it. Given that your patch would not block others for the time being, there is no urgency on us for making any changes and new code (re)designs in terms of authentication in WMCore. All that said, I am now in favor of decreasing the priority level of this issue to a more bearable one rather than the |
Thank for these details, @todor-ivanov @Panos512. Yes Todor. Let's demote it for now and tackle this issue whenever tokens come to our planned quarterly activities. I just changed a few tags. You might want to unassigned yourself and move it back to the Todo list as well (and away from Q1). |
@Panos512 , in order to properly resolve this issue I need to know from you how CRIC data-format will evolve, what is its schema, etc. In particular, I need to know where in user record of CRIC the
So, the two questions I need to know:
Once you'll provide this info I can adjust code accordingly to handle new attributes in CRIC records. |
Hi @vkuznet absolutely, let me start by explaining how our schema looks like and what was the In general, inside CRIC a user group can have a Here is the schema of the two:
The new The problem came because I have forgotten how we expose information thought the legacy Roles API preset that was developed to offer backwards compatibility with SiteDB when we migrated few years ago. In the roles API we expose the list of cms-cric users, adding the ROLES attribute. This attribute contains for each group of the user the following information:
On top of that, for all groups with the When the groups with the new In order to avoid future problems I have modified all those legacy APIs to only expose groups with the As for schema evolution there are no plans for it to evolve any time soon. The problem was that in the roles API we expose values of the schema as schema attributes (by using the role name and the tag rel as keys). So when I thought I was adding a new value I was technically introducing new attributes in the roles API. I hope this helps, I can share more details/clarifications if needed |
Panos, thanks for details. I would like to make few comments:
I just need concrete example, especially what you added which caused the issue (I think the structure like this). |
@vkuznet Valentin, you probably missed some of the progress already made here. Todor started working on it and provided this candidate fix: but given that Panos "fixed" this new group on the CRIC side, we deciced to wait for a final decision on how the iam_group will be deployed in CRIC, before proceeding with any changes in WMCore. Since then, this issue has been demoted and will be tackled in the future. |
Alan, I did not miss anything and saw Todor's patch. I would like to provide a fix which will avoid patching the code every time something will be added in CRIC. Once I'll provide new PR it will incorporate Todor's fix. |
This is no longer a priority for this quarter. If you have a free slot, please reach out to me on Slack and we can work on something that is originally planned for this quarter. Apologies for missing the "Urgent Ops" label, that should have been removed when Todor demoted it. |
Impact of the bug
All services.
Describe the bug
We were contacted to check an
HTTP error 500
coming from our services related to a single DN. While checking the logs I managed to confirm that certain DNs do trigger an exception in our authentication code at the REST module. [1] (user related information has been stripped off for security reasons).Upon further debugging the root of the problem has been identified, and even the time of the OPS activities causing it matched perfectly with our observations.
In WMCore there is this function, which checks all groups and roles associated to a user in order to authenticate him:
WMCore/src/python/WMCore/REST/Auth.py
Line 127 in 747c70a
This function lives in the REST module and does these checks by iterating through all HTTP headers of the request, both:
WMCore/src/python/WMCore/REST/Auth.py
Lines 17 to 20 in 747c70a
In one of those headers added by the FE we now see an unknown type of group:
iam_group
. Checking with @drkovalskyi and @Panos512 it became clear that the new type/category of groups has been added to CRIC yesterday related to some new development for enabling token based authentication. And only a particular set of users have been associated with it. The error we observe is simply because we know nothing about this new category of role/group. If it was just a new group... that wouldn't have broken anything, but being it a completely new type, then few lines of code need to be added on our side.Here is the Jira Ticket associated with this: [2]
And here is a really important twiki page explaining what it is all about [3]
How to reproduce it
Anybody who has this new type of group/role associated with his account in CRIC would receive
Internel server error HTTP 500
when trying to connect to WMCore services, regardless of the client or the method of authentication he uses (so far x509 only).Expected behavior
Not to have the service broken because of a change in CRIC.
Additional context and error message
[1]
[2]
https://its.cern.ch/jira/browse/CMSKUBERNETES-220
[3]
https://twiki.cern.ch/twiki/bin/viewauth/CMS/IAMTokens
The text was updated successfully, but these errors were encountered: