Skip to content

[Security] make secret required for DefaultLoginRateLimiter #52724

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

Merged

Conversation

RobertMe
Copy link
Contributor

Q A
Branch? 6.4
Bug fix? yes/no
New feature? no
Deprecations? yes/no
Issues
License MIT

This tickets results from the discussion here: #52469 (review) and @nicolas-grekas requested a PR for it.

The secret parameter has been added in #51434 with a default value of '' and a deprecation message that it is required / may not be empty. Which is fine and doesn't hurt backwards compatibility.

The later ticket #52469 changes the deprecation into an exception, as it is undesirable that no secret is used (in any scenario). This leads to the unintended side effect that there is a BC breakage when a developer manually creates a DefaultLoginRateLimiter as it is now actually required to provide a (non empty) value due to the check and exception.

Allowing the service / class to be used without providing the secret parameter, in a backwards compatible manner, but then still breaking the backwards compatibility by throwing due to the default value is confusing. So making the secret required makes more sense from a developer perspective as it is clear in that the parameter must be provided.

The `secret` parameter has been added in symfony#51434 with a default value of
`''` and a deprecation message that it is required / may not be empty.
Which is fine and doesn't hurt backwards compatiblity.

The later ticket symfony#52469 changes the deprecation into an exception, as it
is undesirable that no secret is used (in any scenario). This leads to
the unintended side effect that there is a BC breakage when a developer
manually creates a `DefaultLoginRateLimiter` as it is now actually
required to provide a (non empty) value due to the check and exception.

Allowing the service / class to be used without providing the secret
parameter, in a backwards compatible manner, but then still breaking the
backwards compatibility by throwing due to the default value is
confusing. So making the `secret` required makes more sense from a
developer perspective as it is clear in that the parameter must be
provided.
@nicolas-grekas
Copy link
Member

Thank you @RobertMe.

@nicolas-grekas nicolas-grekas merged commit d3aa478 into symfony:6.4 Nov 26, 2023
@RobertMe RobertMe deleted the login-rate-limiter-require-secret branch November 26, 2023 14:27
This was referenced Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants