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

Deleting no longer used privileges #24873

Merged
merged 3 commits into from
Nov 26, 2018
Merged

Conversation

kobelb
Copy link
Contributor

@kobelb kobelb commented Oct 30, 2018

We've gotten away without needing the ability to delete no longer specified privileges because we've been working with a fixed set of privileges until now. However, with the addition of #20277 we're going to need this functionality if we allow application themselves to drive privileges being defined, and the user later uninstalls that plugin.

Elasticsearch's Privilege API requires us to execute an individual DELETE for any privilege that we'd like deleted, as the POST API only allow bulk "upserts".

@kobelb kobelb added non-issue Indicates to automation that a pull request should not appear in the release notes v7.0.0 Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v6.6.0 labels Oct 30, 2018
@kobelb kobelb requested a review from legrego October 30, 2018 22:28
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@kobelb
Copy link
Contributor Author

kobelb commented Nov 19, 2018

@legrego I added in a separate log statement and updated the tests, this is good for another review whenever you get the chance.

Copy link
Member

@legrego legrego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested locally

return;
}
default: {
expect(true).toBe(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: test failures here might be hard to debug. Consider throwing an explicit exception about this unhandled scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we just threw an explicit exception here, it'd potentially be caught by the code using the callWithRequest and lead to rather difficult to understand behavior. I wanted to fail the test explicitly, and this was the most clear solution that I could come up with, even though it isn't really clear at all. I thought about also doing the equivalent of expect(api).toBeInArray(['shield.getPrivilege', 'shield.postPrivileges', 'shield.deletePrivilege'] but figured that'd be equally confusing, and potentially more-so, so I gave up and did this.

@kobelb kobelb merged commit d61786f into elastic:master Nov 26, 2018
@kobelb kobelb deleted the delete-old-privileges branch November 26, 2018 17:30
kobelb added a commit to kobelb/kibana that referenced this pull request Nov 26, 2018
* We can now delete old privileges

* Logging message when error deleting specific privilege
kobelb added a commit to kobelb/kibana that referenced this pull request Nov 26, 2018
* We can now delete old privileges

* Logging message when error deleting specific privilege
kobelb added a commit that referenced this pull request Nov 26, 2018
* We can now delete old privileges

* Logging message when error deleting specific privilege
kobelb added a commit that referenced this pull request Nov 26, 2018
* We can now delete old privileges

* Logging message when error deleting specific privilege
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non-issue Indicates to automation that a pull request should not appear in the release notes Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v6.6.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants