Skip to content

TemplateUpgradeService runs updates under existing ThreadContext  #30603

Closed
@tvernum

Description

@tvernum

The TemplateUpgradeService has a high level flow of:

  • receive ClusterChangedEvent
  • check preconditions (global block, master node, etc)
  • gather necessary updates from registered upgraders (plugins)
  • apply template updates on the generic thread pool.

However

  • the ClusterChangedEvent comes in with the same ThreadContext as the action that triggered the event (which might be a node join/leave, but it also might be a settings change or index create/delete over REST).
  • The generic threadpool execute preserves the ThreadContext from the calling code.

Consequently, the template update runs with a ThreadContext that matches the original triggering action.
If X-Pack Security is enabled, that means that update which should run as _system might attempt to run as the user which authenticated to the Rest API. That user may not have privileges to perform that update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Core/Infra/PluginsPlugin API and infrastructure:Distributed Coordination/Cluster CoordinationCluster formation and cluster state publication, including cluster membership and fault detection.:Security/AuthenticationLogging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions