Skip to content

[Feature Request] Create a mechanism to track if the current execution is within a block where the ThreadContext has been stashed #14733

@cwperks

Description

@cwperks

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:

  1. Enforcing plugins only interact with their own system indices
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    PluginsenhancementEnhancement or improvement to existing feature or requestuntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions