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

[5.5] Crypto-based password resets #17499

Closed
wants to merge 3 commits into from
Closed

Conversation

tillkruss
Copy link
Contributor

Same as #17052.

As discussed with @taylorotwell, a proof-of-concept for crypto-based password resets.

This approach allows us to drop the password_resets table and remove the TokenRepositoryInterface and DatabaseTokenRepository. See laravel/laravel changes.

The email field has been removed from the reset form.

If the reset link is expired/invalid, or the user doesn't exists, then the password reset form is hidden and an appropriate warning message is displayed.

@juukie
Copy link
Contributor

juukie commented Feb 10, 2017

👏 nice

return $this->tokens->exists($user, $token);
$key = $this->app['config']['app.key'];

if (Str::startsWith($key, 'base64:')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does nowhere else in the framework do this base64 decoding of the app key? Seems like there should be...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkout EncryptionServiceProvider and KeyGenerateCommand.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, well that kind of code duplication is getting a bit messy. Going off topic a bit but I've proposed some improvements to this laravel/ideas/issues/416

@garygreen
Copy link
Contributor

Awesome stuff! 👍

@@ -35,15 +45,15 @@ class PasswordBroker implements PasswordBrokerContract
/**
* Create a new password broker instance.
*
* @param \Illuminate\Auth\Passwords\TokenRepositoryInterface $tokens
* @param \Illuminate\Contracts\Foundation\Application $app
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't inject the entire application here just to get the key. Just inject the key.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Changed in c709b25.

@sisve
Copy link
Contributor

sisve commented Mar 8, 2017

Would it be possible to keep and deprecate the old DatabaseTokenRepository for a release, instead of completely removing it?

Relevant: laravel/ideas#383 (Deprecating changes for 1 release instead of removing)

@garygreen
Copy link
Contributor

garygreen commented Mar 8, 2017

@sisve the suggestion in that thread seems to allude towards deprecate things "that can be aliased" - I don't see any point in keeping the old system for one release in this instance - having it as upgrade notes should be suitable.

@tillkruss
Copy link
Contributor Author

tillkruss commented Mar 10, 2017

As an alternative to deprecating it, the DatabaseTokenRepository could be move into a 3rd-party package, similar to tinker and browser-kit-testing in v5.4.

@browner12
Copy link
Contributor

can you ELI5 what this means, and what the process kind of looks like?

@molteber
Copy link

Is this somewhat simular as a JWT? The concept looks familiar. Looks good 👍

@tillkruss
Copy link
Contributor Author

Yeah somewhat similar, here is an article on it.

@sisve
Copy link
Contributor

sisve commented Mar 15, 2017

@garygreen Taylor has now commented that "we will attempt to deprecate removals for 1 release in the future".

I see no reason that crypto-based password resets cannot live side-by-side. Isn't it, to over-simplify it, just two different kinds of token generators/validators; one that uses a repository, another that uses this new technology?

Or, to turn the question around; why must the old functionality be removed when this is introduced?

@taylorotwell
Copy link
Member

Honestly I think I may table this for now unless there is a severe security problem with our current approach. Trying to stabilize out these releases a bit more.

@tillkruss
Copy link
Contributor Author

tillkruss commented Mar 18, 2017

Okay. If anyone wants this as a package, LMK.

garygreen referenced this pull request Mar 13, 2018
This implements the ability to generate signed (and tempoorary) URLs. These URLs may be easily verified as having been generated by your application and not modified by the end-user.
@garygreen garygreen mentioned this pull request Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants