Skip to content
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

Anonymous role resolution change may break stored Authentication objects #57711

Closed
tvernum opened this issue Jun 5, 2020 · 3 comments
Closed
Assignees
Labels
blocker >bug :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team

Comments

@tvernum
Copy link
Contributor

tvernum commented Jun 5, 2020

In #53453 we moved the resolution of the anonymous role from authorization time to authentication time.
As a consequence, it is likely that stored Authentication headers (as used in Watcher, ML and CCR) may see a change in behaviour.

Assume a cluster with the anonymous role set to superuser .
In 7.7, if user with no other roles authenticated and created a new Watch, we would serialize an Authentication object with no roles. When the watch ran we would deserialize that object, but we would run the with superuser privileges because the AuthorizationService would add the role in automatically.

If that same Authentication object is deserialized on 7.8, it will have no roles, and will not be granted the superuser role because the anonymous role logic no longer exists in the AuthorizationService.

We intend to revert #53453 and come up with a new solution to the original problem regarding reporting of anonymous roles.

@tvernum tvernum added >bug blocker :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) labels Jun 5, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (:Security/Authentication)

@elasticmachine elasticmachine added the Team:Security Meta label for security team label Jun 5, 2020
@ywangd
Copy link
Member

ywangd commented Jun 5, 2020

First of all, changes of #53453 can be reverted cleanly on 7.8 branch.

Now after some digging, the behaviour is a bit more involved.

In 7.7, if user with no other roles authenticated and created a new Watch, we would serialize an Authentication object with no roles

  1. If the user is an anonymous user, i.e. incoming request without any credentials, we would actual serialise the anonymous role. Because the authentication process recognise the anonymous user and resolves its roles before authorization. That is, if watcher is setup with an anonymous user, it will continue to work in 7.8.

  2. If, however, the user is a named user with no roles, then yes the Authentication object would be serialised with no roles. If a watcher is setup this way, it will break in 7.8.

When anonymous roles are relied on to setup and execute things like watchers, it is likley that the entire cluster runs with anonymous superuser roles. As I understand it, this is userful to users for approximating a "security-less" cluster for ECE where security is always on (or troublesome to disable). This corresponds to the above scenario 1 and things would continue working for 7.8.

Scenario 2, in my opinion, is probably unlikely out there? But this is just my guess, because it does not seem to be a great use of anonymous roles. This setup also has some more difference between 7.7 and current 7.8.

  • For 7.7, if a new watcher is created with anonymous roles enabled, it will stop working when anonymous roles are disabled.
  • But for 7.8, if a new watcher is created with anonymous roles enabled, it will keep working when anonymous roles are disabled.
    I am not sure which behaviour is more correct. It could be they are both correct from different perspective.

So overall I think the issue is not as bad. But it is an issue nonetheless (behaviour changes including what is previously discussed). Given the revert is straightforward, I am happy to go ahead with it which also buys us some more time to think this through.

@ywangd
Copy link
Member

ywangd commented Jun 9, 2020

Done revert (#57857) for 7.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker >bug :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team
Projects
None yet
Development

No branches or pull requests

3 participants