Skip to content
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

Doorkeeper shouldn't generate a secret for public clients #1724

Closed
ThisIsMissEm opened this issue Jul 28, 2024 · 2 comments · Fixed by #1727
Closed

Doorkeeper shouldn't generate a secret for public clients #1724

ThisIsMissEm opened this issue Jul 28, 2024 · 2 comments · Fixed by #1727

Comments

@ThisIsMissEm
Copy link
Contributor

Currently doorkeeper's Application model always generates a secret value, even when the client type should not have a client secret generated (i.e., public clients). This means we're storing a secret for applications even when a secret value is completely unneeded

I think the model & migrations likely need to be changed to make oauth_application.secret nullable, and only generate a secret if app.confidential?

The Doorkeeper::Application.by_uid_and_secret() method does do the right thing and not bother with secret validation if the client is public.

However, I'm not sure if POST /oauth/token will explicitly reject the request if client_secret is presented despite the client being public. It seems this happens more through a side effect of by_uid_and_secret()'s logic.

This would save significant database resources for applications such as Mastodon, where we've a significant number of applications, due to using a form of Dynamic Client Registration. (i.e., the application count is in the tens or hundreds of thousands, if not millions).

@nbulaj
Copy link
Member

nbulaj commented Aug 1, 2024

Thanks @ThisIsMissEm , agree, that would be great to change. Better to arrange API as well 👍 Would you like to propose a MR? Not sure when I'll be free to check it

@nbulaj
Copy link
Member

nbulaj commented Aug 13, 2024

Prepared a draft MR @ThisIsMissEm - #1727
If you have a chance to check - will be thankful 🤝

Basically API should already consider public/private clients when we introduced such functionality so I don't think we need to do here anything.

Existing applications have to remove not null constraint. Maybe I missed something more?

@ThisIsMissEm ThisIsMissEm changed the title Doorkeeper generates a secret for public clients Doorkeeper shouldn't generate a secret for public clients Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants