-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Authz] Operator privileges (#196583)
## Summary This PR adds support for explicit indication whether endpoint is restricted to operator only users. ### Context 1. If user has [all operator privileges](https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/operator/DefaultOperatorOnlyRegistry.java#L35-#L53) granted, but is not listed as operator in `operator_users.yml`, ES would throw an unauthorized error. 2. If user is listed as operator in `operator_users.yml`, but doesn't have necessary privileges granted, ES would throw an unauthorized error. 3. It’s not possible to determine if a user is operator via any ES API, i.e. `_has_privileges`. 4. If operator privileges are disabled we skip the the check for it, that's why we require to explicitly specify additional privileges to ensure that the route is protected even when operator privileges are disabled. ### Checklist - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios __Relates: https://github.com/elastic/kibana/issues/196271__ ### How to test 1. Add your user to the operators list https://github.com/elastic/kibana/blob/1bd81449242a1ab57e82c211808753e82f25c92c/packages/kbn-es/src/serverless_resources/operator_users.yml#L4 or use existing user from the list to log in. 2. Run ES and Kibana serverless 3. Change any endpoint or create a new one with the following security config ``` security: { authz: { requiredPrivileges: [ReservedPrivilegesSet.operator], }, }, ``` 4. Check with enabled and disabled operator privileges (set `xpack.security.operator_privileges.enabled`) ## Release Note Added support for explicit indication whether endpoint is restricted to operator only users at the route definition level. --------- Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
60399ab
commit 52dd7e1
Showing
14 changed files
with
354 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
x-pack/packages/security/plugin_types_server/src/authorization/es_security_config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { Client } from '@elastic/elasticsearch'; | ||
|
||
type XpackUsageResponse = Awaited<ReturnType<Client['xpack']['usage']>>; | ||
type XpackUsageSecurity = XpackUsageResponse['security']; | ||
|
||
export type EsSecurityConfig = Pick<XpackUsageSecurity, 'operator_privileges'>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.