Bug in Basic Authentication parsing for client credentials
We have noticed that some of our (NodeJS based) clients have started having issues connecting to IdentityServer4 using existing code. There are two issues related to this on the library that we use:
https://github.com/lelylan/simple-oauth2/issues/148
https://github.com/lelylan/simple-oauth2/issues/167
As far as we have found, we can't use any special chars in client secrets in newer versions of the above lib. This kind of issue sounds a bit hairy that could end up breaking existing applications if behavior is changed.
Have you posted a question to Stack Overflow? Please do and post the link here. You'll likely need to post at least some code fragments from your clients to go with that question.
What kind of question would be suitable for stackoverflow?
Clients in possession of a client password MAY use the HTTP Basic authentication scheme as defined in [RFC2617] to authenticate with the authorization server. The client identifier is encoded using the "application/x-www-form-urlencoded" encoding algorithm per Appendix B, and the encoded value is used as the username; the client password is encoded using the same algorithm and used as the password. - Source
The code to reproduce it is simply to use the above mentioned library to connect to identity server with a password that is different when url encoded.
https://github.com/lelylan/simple-oauth2/blob/master/example/index.js
const oauth2 = simpleOauthModule.create({
client: {
id: 'client.id',
secret: 'asfdasd+fdsafdsa^fdsafsd&',
},
auth: {
tokenHost: 'https://id.somedomain.com',
tokenPath: '/connect/token',
authorizePath: '/connect/authorize',
},
});
Since I've not read the spec, I was hoping that someone else could read it and say : yay or nay. If this is something that is wrong in identity server, then changing it might break things ...
yes
https://identityserver4.readthedocs.io/en/release/intro/specs.html
thanks @leastprivilege
I'm closing the question, since it's answered.
I currently have not enough time to file a full bug report. But someone with more time could perhaps do that ...
If I may jump in here, username and password (from OAuth2 clients) must be url-encoded according to RC6749. This is to keep consistency between using them in POST body, query params, and headers as well as to prevent this (what's the username? what's the password?): user:name:password (urlencoded: user%3Aname:password). If that's not the case, then you should consider fixing it.
HTTP Basic says the username is TEXT (except the ":"), whereas 6749 says it's a form-urlencoded value. But those aren't exactly the same.
What we implemented was HTTP basic authentication, not the OAuth2 version of HTTP basic.
So this is what you think we need to change to?
Authorization Basic Base64(FormUrlEncode(client_id):FormUrlEncode(client_secret))
fixed on dev
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.