Repository navigation
Ask before handing an app its sign-in code - #49
Merged
Merged
Conversation
A link anyone sends can begin an app's sign-in with their own PKCE challenge, and another app on the person's device may claim the apps' scheme, so the browser no longer goes straight back to the app with a code. The server's page names the GoChat account and what the code does (sign in, link, or sign in again to delete), warns against links someone sent, and gives the code to the app only when the person taps Continue. FinishSSO says what an app's code does, and for whom, with app_code_use, app_username and email.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes, as far as a custom scheme allows, the gap noted in #48: the server sent an app's code straight to
io.github.ssenerg.gochat:/sso, which any app may claim.The attack
Someone begins an app sign-in with their own PKCE challenge and sends the link
/login/sso/<provider>?app=<challenge>. The victim opens it and is signed in at the provider without being asked. The server then redirects to the custom scheme with a code for the victim's account. If a malicious app on the victim's device claims the scheme, it forwards the code, and the sender redeems it with their verifier. PKCE doesn't help here, because the attacker began the flow. The same works for an app's link: it would link the victim's provider account to the sender's GoChat account.The fix
The server no longer hands a code over by itself. This follows RFC 8252 §8.6: when a client's redirect can't prove which app it reaches, ask the person every time.
@annwithann@corp.test;@annwith that account from now on (a link);@annso it can delete the account (a sign-in again).FinishSSOResponsegainsapp_code_use(a newAppCodeUseenum),app_usernameandemail, so the web can say all this. The apps need no change: their browser sheet shows the page and comes back on the tap.Why not claimed HTTPS redirects
App Links and Universal Links would close this for good, but they don't fit GoChat:
ASWebAuthenticationSession, and the app supports 16.Tests
go test -race ./..., golangci-lint v2.15.0 (0 issues),buf lint,buf breakingagainst main.:core:jvmTestpasses. The iOS app builds (xcodebuild ... CODE_SIGNING_ALLOWED=NO).ASWebAuthenticationSession.