Repository navigation
fix(endpoint-auth): use publication me when signing authorization code - #913
paulrobertlloyd merged 2 commits into
Conversation
|
Created this as a draft because I still need to test this locally but my brain needs sleep... |
|
Okay, I tested this and confirmed that the access token and json response contain the value from publication.me. Sparkles was able to post successfully (though it shows the original rello.me as the logged in value). Quill was able to login and shows www.ciccarello.me as the logged in user. My only remaining question is if there could be a problem if someone else set up their publication.me slightly differently (e.g. with a trailing slash) would that cause their Indiekit to stop posting and cause confusion? I wonder if this PR should get the canonical URL before setting the |
959511f to
e38b315
Compare
67b3847 to
fa1d368
Compare
d2767a9 to
525ebe3
Compare
|
@aciccarello If you want to rebase this PR with the latest changes in |
e38b315 to
7088734
Compare
|
Looks like there is some kind of build permissions issue that is preventing the localization secrets to be loaded. My build logs show: While passing builds show |
|
@aciccarello Does the merger of #977 fix this for you? |
Previously, the me value supplied by the client in the authorization request was signed directly into the authorization code. If that value differed from publication.me (e.g. a redirect URL), the issued token would fail verification at query time. Per the IndieAuth spec (sections 5.2, 5.3.2, 5.3.3), the authorization server may ignore the client-supplied me and return its own canonical profile URL. publication.me is now always used when signing the code. The client-supplied me is still echoed back in the redirect response for backwards compatibility. Fixes getindiekit#911
7088734 to
bc6dec3
Compare
|
Looks like it does! |
What
When signing the authorization code in
consent.post, always usepublication.meas themevalue instead of the client-suppliedmeparameter.Why
The IndieAuth spec allows clients to optionally pass a
meparameter in the authorization request. Indiekit was signing whatever value the client sent directly into the authorization code and subsequent access token. If that URL differed from the configuredpublication.me(e.g. because it was a redirect to the canonical URL),verifyTokenValueswould reject the token at query time, causing authentication to silently fail.The IndieAuth spec explicitly permits this approach: section 5.2 says the authorization endpoint *MAY* ignore the client-supplied
meentirely, and sections 5.3.2 and 5.3.3 note the returnedme*MAY* differ from the URL the client provided, giving the server an opportunity to canonicalize it.The client-supplied
meis still echoed in the redirect response for backwards compatibility with older clients.Changes
packages/endpoint-auth/lib/controllers/consent.js: usepublication.mewhen signing the authorization codepackages/endpoint-auth/test/integration/302-consent-submit-authenticate-with-me.js: updated to use a mismatchedmevalue and assertpublication.meis in the signed codepackages/endpoint-auth/test/integration/302-consent-submit-authenticate.js: updated to assertpublication.meis used when nomeparam is suppliedFixes #911