Skip to content

Core: Do not pass parent Bearer header in client_credentials token request#16056

Open
bharos wants to merge 1 commit intoapache:mainfrom
bharos:fix/oauth2-credential-bearer-leak
Open

Core: Do not pass parent Bearer header in client_credentials token request#16056
bharos wants to merge 1 commit intoapache:mainfrom
bharos:fix/oauth2-credential-bearer-leak

Conversation

@bharos
Copy link
Copy Markdown
Contributor

@bharos bharos commented Apr 20, 2026

fromCredential() was passing parent.headers() (containing the parent session's Bearer token) to fetchToken when making a client_credentials grant request. This violates RFC 6749 Section 2.3 which states the client MUST NOT use more than one authentication method per request.

IDPs like CAS and AWS Cognito reject the request due to the extra Authorization header, while lenient IDPs silently ignore it.

All other fetchToken call sites correctly pass Map.of(). This change aligns fromCredential() with that pattern.

Closes #13337

@github-actions github-actions Bot added the core label Apr 20, 2026
@bharos
Copy link
Copy Markdown
Contributor Author

bharos commented Apr 20, 2026

cc @adutra PTAL at this auth related PR, thanks!

@bharos bharos force-pushed the fix/oauth2-credential-bearer-leak branch from 83406e6 to a1d24f3 Compare April 20, 2026 02:27
…quest

fromCredential() was passing parent.headers() (containing the parent
session's Bearer token) to fetchToken when making a client_credentials
grant request. This violates RFC 6749 Section 2.3 which states the
client MUST NOT use more than one authentication method per request.

IDPs like CAS and AWS Cognito reject the request due to the extra
Authorization header, while lenient IDPs silently ignore it.

All other fetchToken call sites correctly pass Map.of(). This change
aligns fromCredential() with that pattern.

Closes apache#13337
@bharos bharos force-pushed the fix/oauth2-credential-bearer-leak branch from a1d24f3 to eb2f382 Compare April 20, 2026 04:17
@adutra
Copy link
Copy Markdown
Contributor

adutra commented Apr 22, 2026

This PR likely fixes one of the biggest client authentication issues in the current auth manager. I briefly alluded to it in the auth manager v2 design doc:

https://docs.google.com/document/d/1Hxw-t8Maa7wZFmrlSujm7LRawKsFP3Q31tET_3aRnQU/edit?tab=t.0#bookmark=id.td3wbcmg3va2

But, it's a behavioral regression. I'm not sure it's safe to introduce it without placing it behind a feature flag.

\cc @nastra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth2: OAuth2Manager#newSessionFromCredential shouldn't pass Authorization: Bearer xxx from parent

2 participants