-
Notifications
You must be signed in to change notification settings - Fork 357
Description
Coming from:
[Meta] Making OpenSearch Extensible opensearch-project/OpenSearch#2447
[Meta] Plugin Sandboxing (a.k.a extensions) opensearch-project/OpenSearch#1422
Problem
As we are building extensions, security is an integral part of everything we deliver. We see a bunch of problems for plugin security and would like to solve them from Day 1 for extensions.
- Plugins implement security constructs by themselves, evaluating permissions and gating resources manually.
Anomaly Detection: https://github.com/opensearch-project/anomaly-detection/blob/main/src/main/java/org/opensearch/ad/util/ParseUtils.java#L465
Alerting: https://github.com/opensearch-project/alerting/blob/main/alerting/src/main/kotlin/org/opensearch/alerting/transport/SecureTransportAction.kt#L78 - All plugins have super admin permissions and can play with any information they'd like on the cluster.
Anomaly Detection: https://github.com/opensearch-project/anomaly-detection/blob/main/src/main/java/org/opensearch/ad/transport/IndexAnomalyDetectorTransportAction.java#L95
Alerting: https://github.com/opensearch-project/alerting/blob/main/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportExecuteMonitorAction.kt#L68 - Intercommunication with Plugins multiplied with permissions, is manually managed and caused bunch of security loop holes.
Alerting-Anomaly Detection integration: https://github.com/opensearch-project/alerting/blob/main/alerting/src/main/kotlin/org/opensearch/alerting/InputService.kt#L149 - Plugins define the permissions they need with Java Security Manager but there is no gating mechanism to deny/validate permissions.
Anomaly Detection: https://github.com/opensearch-project/anomaly-detection/blob/main/src/main/plugin-metadata/plugin-security.policy
Alerting: https://github.com/opensearch-project/alerting/blob/main/alerting/src/main/plugin-metadata/plugin-security.policy - Security for plugins is driven by thread context assuming they run in the same JVM. Extensions run within, outside of JVM and existing security interfaces do not work.
- Extensions are built on SDK which is not coupled with JSM (as its deprecated) and we don't have a way to restrict extensions with host level resources (like filesystem, network etc)
- Security plugin has support to authenticate/authorize on transport APIs but do not act on any Rest APIs (which is infact the reason why all plugins implemented security at transport layer). Rest APIs are integral part of OpenSearch eco-system and cannot open all APIs to all extensions.
- Extensions access control for accessing resources within OpenSearch is not gated, which brings risk for OpenSearch cluster running 3rd party extensions.
- Plugins are validated during install time as they are only bootstrapped once during a lifetime of a node. They are validated by
bin/opensearch-plugininstallation tool. Extensions can be installed/modified/removed on the fly and needs identity validation before it joins the cluster.
Requirements
- [Extensions] Extensions should be able to call a common API which evaluates permissions and gates resources.
- [Extensions] Extensions by default should not have any permissions, and are explicitly granted based on defined policies.
- [Security into Core and Extensions] All API calls between extensions and OpenSearch are access controlled based on extension permission policies.
- [Extensions and SDK] Extensions SDK should be able to restrict host level access(file system, network etc) based on security policy.
- [Security into Core] Add support to gate Rest APIs for OpenSearch
- [Extensions and SDK] Add support to validate the identity of an extension during runtime. This helps in identifying the extension and claiming if it really is. This is an important requirement for extensions since extensions can be installed/modified/removed on the fly and needs identity validation before it joins the cluster.
- [Extensions and SDK] Compliance: Add support for extensions to do audit logging.
Refactored these requirements from June 2022 to explain the problems above.
To build a MVP for extensions we are working on building Anomaly Detection plugin and help run it as an extension.
Our end goal is to have:
- Load third party extensions securely
- Protect the cluster resources when extensions are installed
- Access control for resources created by extensions (Including APIs, application resources etc)
- Access control OpenSearch resources from extensions.
We can chat over this and get more feedback, but these are the resources we could think of to enable secure extensions.
For a start as we are looking at AD: opensearch-project/OpenSearch#3635
We need help to figure out how AD extension can work with security (adding extension support for common-utils):
- AD uses User information for resource access control
- AD uses InjectUser to inject user permissions for background jobs.