-
-
Notifications
You must be signed in to change notification settings - Fork 484
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
Avoid Username/Email is passed as clear GET Parameter to CheckEmailAction on password reset process #1693
Conversation
Remove usage as discussed in #1692 (comment)
Remove passing username as get Parameter to sonata_user_admin_resetting_check_email as discussed in #1692 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update about changed parameters
SonataUserBundle/src/Resources/config/actions_resetting.php
Lines 38 to 46 in 8713dce
->set('sonata.user.action.check_email', CheckEmailAction::class) | |
->public() | |
->args([ | |
service('twig'), | |
service('router'), | |
service('sonata.admin.pool'), | |
service('sonata.admin.global_template_registry'), | |
abstract_arg('token ttl'), | |
]) |
Sorry, I forgot the service definitions because I'm already way too spoiled by Symfony's autowiring technology |
Ugh, I forgot another location again: SonataUserBundle/src/DependencyInjection/SonataUserExtension.php Lines 123 to 124 in 8713dce
|
@VincentLanglet I think this MR is ready to run the Tests? |
use Twig\Environment; | ||
|
||
final class CheckEmailAction | ||
{ | ||
public function __construct( | ||
private Environment $twig, | ||
private UrlGeneratorInterface $urlGenerator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a BC break.
If someone does new CheckEmailAction($twig, $urlGenerator, $adminPool, ...)
it will now crash.
We have to keep a BC signature. You can get inspiration from https://github.com/sonata-project/SonataUserBundle/blob/4.x/src/GoogleAuthenticator/RequestListener.php#L58-L88
public function __construct(
private Environment $twig,
Pool|UrlGeneratorInterface $adminPool,
TemplateRegistryInterface|Pool $templateRegistry,
int|TemplateRegistryInterface $tokenTtl,
?int $tokenTtl = null,
) {
if ($adminPool instanceof UrlGeneratorInterface) {
if (!$templateRegistry instanceof Pool) {
throw new TypeError(...);
}
$this->adminPool = $templateRegistry;
@trigger_error(sprintf(
'Passing an instance of %s as argument 2 to "%s()" is deprecated since sonata-project/user-bundle 5.x and will only accept an instance of %s in version 6.0.',
UrlGeneratorInterface::class,
__METHOD__,
Pool::class
), \E_USER_DEPRECATED);
} else {
$this->adminPool = $adminPool;
}
// And so on
}
@VincentLanglet about the |
A rebase should solve the issues |
Tried to apply the backward compatibility as good as possible similar to the suggested code. |
|
||
public function __invoke(): Response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For BC, the Request $request
param probably needs to be optional.
(with Deprecate Warning)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I don't think so.
There won't be any error if you pass an extra param
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, i misunderstand the errors there,
it was only Psalm/PHPStan complaining, not a real PHP error.
I rebased fixed and merged in #1695. Thanks ! |
Yey cool |
Subject
Avoid Username/Email is passed as clear GET Parameter to CheckEmailAction on password reset process as discussed in #1692
I am targeting this branch, because this fixes an privacy issue and doesn't break anything.
Closes #1692.
Changelog
Removed