-
-
Notifications
You must be signed in to change notification settings - Fork 331
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
[feature] Implement PKCE for oauth2 #2225
Comments
Unless I'm strongly mistaken, it's here that we need to change something: gotosocial/web/source/settings/lib/query/oauth.js Lines 134 to 145 in d45a75e
That needs to include both the challenge and the challenge method. Roughly:
Then, in: gotosocial/web/source/settings/lib/query/oauth.js Lines 70 to 80 in d45a75e
|
Although, I'm a little confused overall as to how auth works in our frontend, so I might be looking in the wrong places entirely. |
Argh, there's 2 things. I think the code I was just looking add is for the frontend "app" to authenticate, and maybe for app registration? It seems what I want is the gotosocial/internal/oidc/idp.go Line 44 in d45a75e
But since we're doing it fully on the backend, I'm a little surprised I run into PKCE issues. That shouldn't be necessary here. Although it's still a good thing to have. |
Alright, back to where this started: Kani has 2 types of Oauth2 clients, confidential and public ones. Confidential ones, which is what GtS is when it itself is doing the Oauth2 dance, have PKCE required by default but can have it disabled. This is fine, since a confidential client can keep the client secret, well, secret. This happens when you have an IDP configured. Public clients, like a SPA, cannot keep the client secret a secret, and there PKCE should be mandatory. However, I'm not entirely sure what oauth2 things our frontend is doing. There's code that does it, hence my initial confusion about what was happening where. I think we ourselves act as an oauth2 authorization server when username/password auth is in use? We might still want to do something around supporting PKCE there, but idk if this is some Masto-specific flavour that we need to not break for other client apps? |
Is your feature request related to a problem ?
We currently don't do PKCE for oauth2. I discovered this while setting up Kani since it requires PKCE unless explicitly disabled.
Because the frontend can't keep the client secret a secret (since you'd see it in the JS and in the requests your browser does), it's only aware of the client ID (I'm not even sure where it gets this from, as it's in the server's config YAML). PKCE is meant to make it safer to do this kind of thing.
Describe the solution you'd like.
Implement PKCE in the frontend, or do auth without the JS client (so entirely server side) so it's not a "public" client.
Also needs #2224 for completeness.
Describe alternatives you've considered.
Not implement it, but that's meh.
Additional context.
No response
The text was updated successfully, but these errors were encountered: