Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Security] [Throttling] Hide username and client ip in logs#51434

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:6.4fromSpomky:noip-in-cache
Aug 23, 2023

Conversation

@Spomky
Copy link
Contributor

QA
Branch?6.4
Bug fix?yes
New feature?yes
Deprecations?no
TicketsFix#46362
LicenseMIT
Doc PRsymfony/symfony-docs#...TODO

This PR is a proposal for fixing#46362. It appears the username and IP address may be both available in the log or the caching system.
The proposed feature uses the already existing kernel secret to hash the data.

@carsonbotcarsonbot added this to the6.4 milestoneAug 20, 2023
@carsonbotcarsonbot changed the title[Security][Throttling] Hide username and client ip in logs[Security] [Throttling] Hide username and client ip in logsAug 20, 2023
@SpomkySpomkyforce-pushed thenoip-in-cache branch 2 times, most recently frome67079c tobe0e24cCompareAugust 21, 2023 12:11
{
if (!$secret) {
trigger_deprecation('symfony/security-http','6.4','Calling "%s()" with an empty secret is deprecated. A non-empty secret will be mandatory in version 7.0.',__METHOD__);
// throw new \InvalidArgumentException('A non-empty secret is required.');
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be for 7.0, but maybe it'll be better to useSymfony\Component\Security\Core\Exception\InvalidArgumentException instead?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Correct. I changed the line

@SpomkySpomkyforce-pushed thenoip-in-cache branch 3 times, most recently from589e497 toff8a8abCompareAugust 22, 2023 18:15
@nicolas-grekas
Copy link
Member

Thank you@Spomky.

Spomky and OskarStark reacted with hooray emoji

@nicolas-grekasnicolas-grekas merged commit394d52c intosymfony:6.4Aug 23, 2023
@SpomkySpomky deleted the noip-in-cache branchAugust 23, 2023 07:09
This was referencedOct 21, 2023

privatefunctionhash(string$data):string
{
returnstrtr(substr(base64_encode(hash_hmac('sha256',$data,$this->secret,true)),0,8),'/+','._');
Copy link
Member

Choose a reason for hiding this comment

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

I came here to check as I was worried I'd have to complain about a massive cache size increase, but I'm happy to see that it was taken into account and this will actually probably even reduce the cache storage requirements. Thanks!

nicolas-grekas, fancyweb, GromNaN, Spomky, and wouterj reacted with heart emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Honestly, I fell into the trap 😅🤦‍♂️. But there are people here who are very quick-witted and who paid attention to that 😊. #bestcommunityever 👌

xabbuh reacted with heart emoji
nicolas-grekas pushed a commit that referenced this pull requestNov 26, 2023
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 compatiblity.The later ticket#52469 changes the deprecation into an exception, as itis undesirable that no secret is used (in any scenario). This leads tothe unintended side effect that there is a BC breakage when a developermanually creates a `DefaultLoginRateLimiter` as it is now actuallyrequired to provide a (non empty) value due to the check and exception.Allowing the service / class to be used without providing the secretparameter, in a backwards compatible manner, but then still breaking thebackwards compatibility by throwing due to the default value isconfusing. So making the `secret` required makes more sense from adeveloper perspective as it is clear in that the parameter must beprovided.
nicolas-grekas added a commit that referenced this pull requestNov 26, 2023
…r (RobertMe)This PR was merged into the 6.4 branch.Discussion----------[Security] make secret required for DefaultLoginRateLimiter| Q             | A| ------------- | ---| Branch?       | 6.4| Bug fix?      | yes/no| New feature?  | no| Deprecations? | yes/no| Issues        || License       | MITThis 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.Commits-------ecbf0e9 [Security] make secret required for DefaultLoginRateLimiter
fabpot added a commit that referenced this pull requestMay 21, 2024
…kernel.secret% with the rate-limiter (nicolas-grekas)This PR was merged into the 7.1 branch.Discussion----------[SecurityBundle] Use %container.build_hash% instead of %kernel.secret% with the rate-limiter| Q             | A| ------------- | ---| Branch?       | 7.2| Bug fix?      | no| New feature?  | no| Deprecations? | no| Issues        | -| License       | MITIn#51434, we decided to hash the username and the client IP in order to anonymize logs.I propose to use %container.build_hash% instead of %kernel.secret% in order to use %kernel.secret% one less time.%container.build_hash% looks good enough to me, and it doesn't need any external configuration.Related to the discussion happening insymfony/recipes#1314Commits-------574f573 [SecurityBundle] Use %container.build_hash% instead of %kernel.secret% with the rate-limiter
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@OskarStarkOskarStarkOskarStark approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@mtarldmtarldmtarld approved these changes

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

+1 more reviewer

@SeldaekSeldaekSeldaek left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

[Security][Throttling] Hide username and client ip in logs

6 participants

@Spomky@nicolas-grekas@Seldaek@OskarStark@mtarld@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp