fix(mp-rest-client): do not auto-propagate InboundHeadersProvider headers - #6117
Open
arimu1 wants to merge 1 commit into
Open
fix(mp-rest-client): do not auto-propagate InboundHeadersProvider headers#6117arimu1 wants to merge 1 commit into
arimu1 wants to merge 1 commit into
Conversation
…ders DefaultInboundHeaderProvider and application InboundHeadersProviders were stored in a HashSet, so iteration order was nondeterministic. When an application provider ran before DefaultInboundHeaderProvider, its headers were accumulated into inbound and then DefaultInboundHeaderProvider.update() copied that entire map into the outbound request — even with no ClientHeadersFactory. - Use LinkedHashSet so DefaultInboundHeaderProvider stays first - update() only applies RestClientBuilder.header(...) values, not other providers' inbound headers - Regression tests for eclipse-ee4j#6101 Fixes eclipse-ee4j#6101 Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
This was referenced Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes nondeterministic leakage of application
InboundHeadersProviderheaders into outbound MicroProfile Rest Client requests (even when noClientHeadersFactoryis registered).Root cause
DefaultInboundHeaderProviderand applicationInboundHeadersProviderinstances were stored in a plainHashSet(unordered).MethodModel.resolveCustomHeaders()accumulates every provider'sinboundHeaders()into one map.DefaultInboundHeaderProvideris visited, itsClientHeadersFactory.update()copied that entire accumulated map into outbound headers.So if an application provider was iterated before the default provider, inbound-only headers (e.g. Authorization, Cookie) were sent to the remote target. Order depended on
HashSetiteration / hash bucket layout, so different client instances in the same JVM could differ.Fix
LinkedHashSetfor inbound header providers inRestClientBuilderImplandRestClientContext.BuildersoDefaultInboundHeaderProvider(registered first) stays first.DefaultInboundHeaderProvider.update()to only applyRestClientBuilder.header(...)values, never headers from otherInboundHeadersProviders. Those remain available only to an explicit@RegisterClientHeaders/ClientHeadersFactory.Testing
InboundHeadersProviderLeakTest3/3 (100× no-leak stress, builder header still applied, explicit factory still sees inbound)InboundHeadersProviderTest2/2Related
Fixes #6101
Co-reported / analysis by @Verdent; @OndroMih noted the
LinkedHashSetordering requirement.Signed-off-by: arimu1 19286898+arimu1@users.noreply.github.com