Skip to content

Prevent ThreadContext header leak when sending response backport(#68649) #85865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

pgomulka
Copy link
Contributor

We need to stash thread context in DefaultRestChannel before we call
channel.sendResponse because when calling this method, our execution
might be delayed and the thread be reused for another task - like
sending another response.
And it would see thread context from the initial “delayed” work.

This commit also expands the assertions on the empty thread context
to make sure it does not contains response headers.

closes #68278

  • Have you signed the contributor license agreement?
  • Have you followed the contributor guidelines?
  • If submitting code, have you built your formula locally prior to submission with gradle check?
  • If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed.
  • If submitting code, have you checked that your submission is for an OS and architecture that we support?
  • If you are submitting this code for a class then read our policy for that.

We need to stash thread context in DefaultRestChannel before we call
channel.sendResponse because when calling this method, our execution
might be delayed and the thread be reused for another task - like
sending another response.
And it would see thread context from the initial “delayed” work.

This commit also expands the assertions on the empty thread context
to make sure it does not contains response headers.

closes elastic#68278
@pgomulka pgomulka added :Core/Infra/Core Core issues without another label backport labels Apr 13, 2022
@pgomulka pgomulka self-assigned this Apr 13, 2022
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Apr 13, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@pgomulka pgomulka merged commit d02c9a7 into elastic:7.17 Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team v7.17.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants