-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Is your feature request related to a problem? Please describe
Related RFC in the security plugin: opensearch-project/security#4439
I would like to have a mechanism to track which plugin most recently stashed the ThreadContext. Stashing the threadContext is done in the plugin ecosystem in order to allow a plugin to interact with its system indices when the security plugin is installed.
Stashing the threadContext is analogous to running a command as sudo. A plugin that stashes its threadContext is effectively switching contexts, that is instead of running in an authenticated user context its running in an elevated context.
By being able to keep track of where the ThreadContext was most recently stashed, it would be possible to provide richer authorization mechanisms within the block where the threadContext was stashed.
Better authorization includes:
- Enforcing plugins only interact with their own system indices
- Allowing a cluster administrator to explicitly define what actions a plugin can do in a block where the plugin has switched out of the authenticated user context
Describe the solution you'd like
Have some sort of lookup to query if the current execution is within a block where the threadContext is stashed and identify the plugin that stashed the context.
Related component
Plugins
Describe alternatives you've considered
Keep the existing implementation
Additional context
Related RFC in the security plugin: opensearch-project/security#4439