#dev 2022-05-29

2022-05-29 UTC
[dmitshur] joined the channel
#
[dmitshur]
(The following started out as a clarification question about IndieAuth, but I pretty much found what I'm now confident is a definitive answer. Sharing anyway, and in case I made a mistake, correcting my understanding would be very helpful.)
#
[dmitshur]
> `code_challenge = BASE64URL-ENCODE(SHA256(ASCII(code_verifier)))`
#
[dmitshur]
> The client then creates the code challenge derived from the code verifier by calculating the SHA256 hash of the code verifier and Base64-URL-encoding the result.
#
[dmitshur]
The IndieWeb spec describes the how the client creates the code challenge at https://indieauth.spec.indieweb.org/#authorization-request:
#
[dmitshur]
The "Base64-URL-encoding" link was added in https://github.com/indieweb/indieauth/pull/92 and links to an base64 URL algorithm that omits padding.
#
[dmitshur]
I ran into a website with an IndieAuth implementation where I couldn't login with my site because it was sending me a code_challenge of unexpected length (44 bytes instead of 43). The extra character turned out to be a '=' from base64 URL encoding with padding. At first I thought I wasn't sure if maybe I should be allowing both, but looking into it more I realized both sides must agree exactly on whether padding is used or not when
#
[dmitshur]
By now I see that https://www.rfc-editor.org/rfc/rfc7636#section-3 is very clear about what the "Base64url Encoding" term refers to: base64 URL encoding *without* padding:
#
[dmitshur]
generating the code_challenge, otherwise during the "Server Verifies code_verifier before Returning the Tokens" PKCE step the "code_verifier == code_challenge" equality can never hold.
#
[dmitshur]
> with all trailing '=' characters omitted
#
[dmitshur]
(Notably no "optionally" there! Yay for not having to support more than one thing!)
#
[dmitshur]
So if I got all this right, my code requiring the incoming code_challenge to be exactly 43 (not 44) bytes is sound and matches what the IndieAuth spec requires (indirectly, via RFC7636), and I should report the bug to the other side sending me a 44-byte code_challenge with a '=' at the end.
#
aaronpk
you should definitely file a bug for the extra `=`
#
aaronpk
that is not and never has been correct
#
Loqi
definitely
#
aaronpk
it's one of the most common errors I see in PKCE implementations in OAuth too, that and even just forgetting to use the base64-url-safe charset instead of regular base64
#
[dmitshur]
Thanks for confirming. 👍 Will do. The website is open source and I'll be able to send them a PR as well.
#
[dmitshur]
Hmm, I used slack to send my original multi-line message. I was curious how it shows up in non-slack clients (e.g. IRC), so looked at https://chat.indieweb.org/dev/2022-05-29#bottom. I see it split it up (that makes sense). But it also re-ordered the lines? That's unfortunate lol. (FWIW this was the original order: https://user-images.githubusercontent.com/1924134/170848231-0d4ff79e-bb30-4259-8dbc-f093e62afcd4.png.)
#
aaronpk
heh, ordering of IRC messages isn't really guaranteed
#
[dmitshur]
Good for me to keep in mind for the future. 🙂
GWG and cybi joined the channel
#
@terinjokes
↩ī¸ I've restored minimal microformats2 support. I'm currently looking at if I should implement WebMentions.
(twitter.com/_/status/1530756300002381825)
gRegor, alex11, lanodan, tetov-irc, cybi, cjw6k, [Murray], gxt and jacky joined the channel
#
[dmitshur]
> [...] I'll be able to send them a PR as well.
#
Loqi
[dmitshur] #8 don't use '=' padding in base64 URL encoding of S256 code challenge method, be strict about any additional characters
[chrisaldrich], chenghiz_ and jacky joined the channel
#
[Chris_Lott]1
@seirdy I agree it would be much better, but it feels like a long way to get from here to there. I'll check your stuff out and see!
jacky, lanodan, tbbrown and cybi joined the channel
#
GWG
So, I created a new facepile option that looks a lot like seblog.nl and can also switch to an aaronpk like design as I was looking at various alternatives to the existing design.
#
GWG
So, choice is good, I hope
tbbrown, tlark, tetov-irc, cybi, jacky and [Scott_Jack] joined the channel