opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.83k stars 1.83k forks source link

[DRAFT] Add a new sandbox module to provide system index protection from the core #16695

Open cwperks opened 1 day ago

cwperks commented 1 day ago

Description

Opening this PR to demonstrate the challenges of porting system index protection to the core repo. System index protection is provided by the security plugin and protects system indices in the following 2 ways:

  1. Admin operations on the indices are forbidden
    • These indices cannot be deleted
    • These indices cannot be written to with a REST Request, they can only be programmatically accessed
      • For cluster operators needing direct system index access they can present the admin certificate (security plugin concept w/o core analog).
  2. Search requests on system indices get their results scrubbed.
    • Rationale is that system indices can contain sensitive data so while search would give a 200 response, the security plugin clears the result set (search is possible if done with the admin certificate)

This PR provides a crude implementation of system index protection in the core for #1. This PR does not include a core analog of the admin certificate so it would only permit programmatic access to system indices.

One of the biggest challenges implementing system index protection as an Action Filter, is resolving a generic ActionRequest to a list of concrete indices. This PR borrows the IndexResolverReplacer from the security plugin to resolve a generic ActionRequest to a resolved request that contains a list of concrete indices that the request resolves to.

Related Issues

Related to discussion in this thread: https://github.com/opensearch-project/OpenSearch/pull/15778#discussion_r1834692812

Check List

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

github-actions[bot] commented 1 day ago

:x: Gradle check result for dc757242ca5137566632471d226a8e55db667daf: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

github-actions[bot] commented 1 day ago

:x: Gradle check result for fb2cbb0a7d07ae7ae9eca2c27bcb1215df11b339: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

github-actions[bot] commented 1 day ago

:x: Gradle check result for fb2cbb0a7d07ae7ae9eca2c27bcb1215df11b339: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

github-actions[bot] commented 2 hours ago

:x: Gradle check result for d48afcfbb5594385759d1df0b7f09489674a5368: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

github-actions[bot] commented 1 hour ago

:x: Gradle check result for 83896cd06e35b512eecb56d30d029070e2cad8f1: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?