kibana/x-pack/packages
Elena Shostak 52dd7e17c4
[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
1bd8144924/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 <elasticmachine@users.noreply.github.com>
2024-12-12 23:55:04 +01:00
..
ai-infra/product-doc-artifact-builder Sustainable Kibana Architecture: Move modules owned by @elastic/appex-ai-infra (#202410) 2024-12-10 11:36:23 +01:00
index-lifecycle-management/index_lifecycle_management_common_shared Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
index-management/index_management_shared_types Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
kbn-ai-assistant [Obs AI Assistant] Fix null pointer in function definition (#203344) 2024-12-09 15:00:05 +01:00
kbn-ai-assistant-common Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
kbn-alerting-comparators Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
kbn-alerting-state-types Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
kbn-cloud-security-posture [Cloud Security] Show graph visualization in expanded flyout (#198240) 2024-12-12 16:14:44 -06:00
kbn-elastic-assistant [React18] Migrate test suites to account for testing library upgrades security-generative-ai (#201160) 2024-12-12 06:21:20 +01:00
kbn-elastic-assistant-common [Security Solution] Fixes exception item comment validation on newline chars \n (#202063) 2024-12-10 17:19:32 -05:00
kbn-langchain [Security Assistant] Abort signal fix (#203041) 2024-12-05 15:27:29 -06:00
kbn-random-sampling Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
kbn-synthetics-private-location [Synthetics] add synthetics-private-location command (#189531) 2024-08-09 07:02:02 -04:00
maps/vector_tile_utils Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
observability Sustainable Kibana Architecture: Move modules owned by @elastic/obs-ux-management-team (#202832) 2024-12-12 14:28:21 -06:00
rollup Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
search/shared_ui Sustainable Kibana Architecture: Categorise straightforward packages (#199630) 2024-11-22 10:33:25 +01:00
security [Authz] Operator privileges (#196583) 2024-12-12 23:55:04 +01:00