-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat(oauth2) optionally hash client secret #5610
Conversation
5bd8b75
to
5aab605
Compare
79a82de
to
1fca9e0
Compare
5447383
to
238987b
Compare
Why are we supporting more than one hash algorithm? It seems to complicate things substantially and I don’t see it being configurable. And argon it not used anywhere else in this project- let’s not add another dependency if we don’t need it? |
Also, what is the logic behind making hash behavior configurable? We don't have such an option for basic-auth. |
|
In many places like:
etc. You can go to your settings and fetch the API key (and I would say it is very handy albeit less secure). In some contexts like Github I think the flow is: create app secret and it shows you after creation, and after that it is impossible (very cumbersome as you probably also need to configure this and that, that you already had to one which key you cannot get anymore, but yes, more secure too). So because there is legacy in this plugin we wanted to keep it optional and backward compatible and support both scenarios. Both scenarios have good and bad sides, even other than what I explained above. |
For basic-auth I think we didn't even think about that during that point. It is also using hashing function (basic sha1 hash with salt, non-pbkdf2 type) that is not particularly made for hashing passwords. Also it is rare to see any use to store password in plain (e.g. with keycloak I cannot find my password anywhere, but I can see clients and their secrets). |
8dd4ede
to
1ce3df0
Compare
At some point if @fffonion can provide us password hashing functions with |
@fffonion, ok perhaps we should then wait for |
1ce3df0
to
31e7ff5
Compare
@bungle I just released 0.6.0, the kdf api should be available now : ) |
2784211
to
a6d48d8
Compare
This is now updated to use PBKDF2 will output hash like this (contains default settings):
|
a6d48d8
to
ef6bf5d
Compare
ef6bf5d
to
3b03783
Compare
### Summary This was originally implemented with #4866 by @janza. After some review comments, and the introduction of DAO transformations, I decided to make changes, thus opening this new PR. This PR adds a new `boolean` column `hash_secret` to `oauth2_credentials` that is used to determine whether or not the `client_secret` will be hashed. The PR adds support for `argon2`, and `bcrypt` and it uses `argon2` if the system library for argon2 is installed. Otherwise it will fallback to `bcrypt`. The plugin will also check if the `client_secret` needs to be rehashed (on usage). One caveat. If you run this on cluster and some nodes have `argon2` and some don't, it is possible that you cannot use the credentials on those that don't. So keep your environments similar. ### Issues resolved Close #4866, Fix #1237 (at least on OAuth2)
3b03783
to
2d164ff
Compare
Summary
This was originally implemented with #4866 by @janza.
After some review comments, and the introduction of DAO transformations, I decided to make changes, thus opening this new PR.
This PR adds a new
boolean
columnhash_secret
tooauth2_credentials
that is used to determine whether or not theclient_secret
will be hashed.The PR adds support for
pbkdf2
(and contains code forargon2
, andbcrypt
if we want to enable them later). The plugin will also check if theclient_secret
needs to be rehashed (on usage). One caveat. If you run this on cluster and some nodes haveargon2
and some don't, it is possible that you cannot use the credentials on those that don't. So keep your environments similar.Issues resolved
Close #4866, Fix #1237 (at least on OAuth2)