Skip to content
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

OAuth Client Credentials Authorization Broken in 5.6.x #10665

Closed
SledgeHammer01 opened this issue Dec 25, 2021 · 1 comment
Closed

OAuth Client Credentials Authorization Broken in 5.6.x #10665

SledgeHammer01 opened this issue Dec 25, 2021 · 1 comment
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: invalid An issue that we don't feel is valid type: bug A general bug

Comments

@SledgeHammer01
Copy link

SledgeHammer01 commented Dec 25, 2021

OAuth Client Credentials authorization (and some other grant types) is broken in 5.6.x. It was working correctly in 5.5.x. I tracked the issue down to here:

In 5.6.x, at lines 121 & 122, you introduced the call to encodeClientCredential() to encode the username and password. That's not the correct way of encoding basic auth. Basic auth should be encoded as:

Authorization: Basic base64(client_id:client_secret)

By URL encoding the client_secret which is typically a cryptographically random string, you are changing the secret itself. My cryptographically random secret contains a portion "G/g/Vv". In this case you are URL encoding the slashes which should not be done, you shouldn't encode anything here as you just concat client_id:client_secret and base64 that whole thing and pass in through the Authorization header which doesn't require URL encoding.

@SledgeHammer01 SledgeHammer01 added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Dec 25, 2021
@sjohnr
Copy link
Member

sjohnr commented Jan 5, 2022

@SledgeHammer01, this change was intentionally introduced in 5.6, per #9610 (and noted in 5.6.0-M1), which aligns us with RFC 6749, Section 2.3.1. We're aware that this spec unfortunately conflicts with RFC 2617.

See this comment if you need help working around the issue with a non-compliant provider. Also note that we've merged a change for #10130 which simplifies customizing headers beyond what the stackoverflow post linked above demonstrates.

I'm going to close this as working as designed. I understand that this is a frustrating experience as you upgrade, so please don't hesitate to ask if I can help clarify the workaround or anything else needed to get you going again. Thanks for your understanding.

@sjohnr sjohnr closed this as completed Jan 5, 2022
@sjohnr sjohnr added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 5, 2022
@sjohnr sjohnr added the in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: invalid An issue that we don't feel is valid type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants