-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Authenticate API should return the roles that are inhereted from enabled anonymous access #47195
Comments
Pinging @elastic/es-security |
Thanks @tvernum @jkakavas From the surface, I'd prefer a new field for it because of clarity. Otherwise users may have new confusion from another direction, i.e. from "where are my missing roles" to "what are these extra roles". I'd personally name it to something like Not sure whether there is any backwards compatibility issue for adding a new field. Hope it's not too much to justify a new field. |
We generally are fine with adding fields to responses, these are not considered breaking changes and we have the tooling in our serialization logic to take care of version guards. We recently ( in a minor in 6.x ) added the realm information in the _authenticate response too. I agree that the new field fits the principle of least astonishment better |
We had a fair amount of discussion since last post here. This issue is getting more involved and here is a status update based on the discussion during team meeting: TLDR: We prefer to have anonymous roles listed under existing First of all, on the contrary to the initial discussion, we now agree that the anonymous roles should be just part of the existing
The second question is where the anonymous role should be handled. The lifecycle of a role goes through following phases:
In general, step 1 is handled in authentication phase, while step 2 and 3 are handled in authorization phase. However, the anonymous role is a special case in that its role names are handled in authorization phase, specifically
If we just focus on issue 1, we can add new logic in For issue 2, we need to move some logic from Base on above analysis, I prefer to fix issue 1 first and create a separate issue to deal with issue 2. This way we treat the symptom first for immediate user benefit and buy more time to think through on issue 2 and its implications. Once issue 2 is fixed, it should be simple to leverage it to refactor issue 1 (most likely deleting code). |
Authentication is by design node specific so I don't see any issue here.
++ |
But that specific node will be different after the code change. Say we have a 2-node cluster, A and B and they have different anonymous role settings, Currently, the logic is as follows:
After the change, it will become
Note that the runtime anonymous role is change to |
Gotcha. I think I see it as current behavior is a bug and we should fix it, rather than we're making a breaking change in expected behavior. |
I have a change of heart again. I'd like to tackle both issues together. Because fixing issue 1 alone feels hacky and the solution does not do exactly what I want in all cases. The role names are sanitized, deduplicated and compacted during authorization. Although they do represent the final runtime privileges, they could read quite different from those in the authentication object. |
…53453) Anonymous roles resolution and user role deduplication are now performed during authentication instead of authorization. The change ensures: * If anonymous access is enabled, user will be able to see the anonymous roles added in the roles field in the /_security/_authenticate response. * Any duplication in user roles are removed and will not show in the above authenticate response. * In any other case, the response is unchanged. It also introduces a behaviour change: the anonymous role resolution is now authentication node specific, previously it was authorization node specific. Details can be found at #47195 (comment)
…lastic#53453) Anonymous roles resolution and user role deduplication are now performed during authentication instead of authorization. The change ensures: * If anonymous access is enabled, user will be able to see the anonymous roles added in the roles field in the /_security/_authenticate response. * Any duplication in user roles are removed and will not show in the above authenticate response. * In any other case, the response is unchanged. It also introduces a behaviour change: the anonymous role resolution is now authentication node specific, previously it was authorization node specific. Details can be found at elastic#47195 (comment)
…53453) (#55995) Anonymous roles resolution and user role deduplication are now performed during authentication instead of authorization. The change ensures: * If anonymous access is enabled, user will be able to see the anonymous roles added in the roles field in the /_security/_authenticate response. * Any duplication in user roles are removed and will not show in the above authenticate response. * In any other case, the response is unchanged. It also introduces a behaviour change: the anonymous role resolution is now authentication node specific, previously it was authorization node specific. Details can be found at #47195 (comment)
Reopenning the issue since the change is reverted with #57853 |
Authenticated users inherit the roles that are specified for anonymous users. There is already an issue tracking making this more obvious in the documentation.
The
_authenticate
API should also return the anonymous roles in the response along with the roles that the authenticated user is assigned and/or mapped to.The text was updated successfully, but these errors were encountered: