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

Hide sensitive information withSensitiveParameter attribute#46183

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
fabpot merged 1 commit intosymfony:6.2fromGromNaN:sensitive-parameter
Jul 11, 2022

Conversation

@GromNaN
Copy link
Member

@GromNaNGromNaN commentedApr 27, 2022
edited
Loading

QA
Branch?6.2
Bug fix?no
New feature?yes
Deprecations?no
Ticketsn/a
LicenseMIT
Doc PRn/a

New feature for PHP 8.2:Redact parameters in back traces

This could be a "minor" change, but I think it should be highlighted to be fully functional. The annotation is required in all calling functions otherwise the argument value is displayed.

@carsonbotcarsonbot added this to the6.1 milestoneApr 27, 2022
@carsonbotcarsonbot changed the title[PasswordHasher] Hide sensitive information from stack traces withSensitiveParameter attribute[PasswordHasher] Hide sensitive information from stack traces withSensitiveParameter attributeApr 27, 2022
@GromNaNGromNaN modified the milestones:6.1,6.2Apr 27, 2022
6.2
---

* Hide sensitive information from stack traces with`SensitiveParameter` attribute
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Added the info to the changelog for discoverability.

chalasr reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to be more precise about "Hide". It's "only" for back traces.

GromNaN reacted with thumbs up emoji
* @throws InvalidPasswordException When the plain password is invalid, e.g. excessively long
*/
publicfunctionhash(string$plainPassword):string;
publicfunctionhash(#[\SensitiveParameter]string$plainPassword):string;
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The attribute has no effect on the interface, but is a remainder for implementers.

@GromNaNGromNaN changed the title[PasswordHasher] Hide sensitive information from stack traces withSensitiveParameter attribute[PasswordHasher] Hide sensitive information withSensitiveParameter attributeApr 27, 2022
@javiereguiluz
Copy link
Member

Just saying: in the PHP repository there was an issue about making this#[\SensitiveParameter] feature configurable because in dev/test you probably don't want to hide anything.

Seephp/php-src#8381

GromNaN reacted with thumbs up emoji

@GromNaN
Copy link
MemberAuthor

@javiereguiluz we should expose theSensitiveParameterValue in Symfony error page and profiler?

@javiereguiluz
Copy link
Member

I don't know. It was just a "maybe we should think about this" comment.

Imagine a bug where you mistyped some chars in your password. But is that common?

@chalasr
Copy link
Member

Can you take a look at the rest of the codebase where this could be useful? I think it's fine do it once for all, everywhere plain credentials are passed around (#46853 mentions some relevant places btw)

@TimWolla
Copy link
Contributor

RFC author here 👋

Can you take a look at the rest of the codebase where this could be useful? I think it's fine do it once for all, everywhere plain credentials are passed around

I recommend not just looking at credentials, but also stuff like plaintext values that are passed into an encryption component to be encrypted. I'm not a Symfony user, but an example would likely beCsrfTokenManager::randomize().

My php-src PR that adds the attribute is this one:php/php-src#8352, it might be a good reference.

chalasr and GromNaN reacted with thumbs up emoji

@GromNaN
Copy link
MemberAuthor

GromNaN commentedJul 9, 2022
edited
Loading

I added the attribute on every parameter that looks like a secret.

Notes:

  • A DSN string can contain the password. Hiding the whole DSN can hurt debugging.
  • Some functions cannot throw an exception or make an error. Adding the annotation may be useless.
  • This attribute is not a guarantee that a sensitive value will not be exposed. This values are passed to generic functions that will not have the attribute.

@GromNaNGromNaN changed the title[PasswordHasher] Hide sensitive information withSensitiveParameter attributeHide sensitive information withSensitiveParameter attributeJul 9, 2022
@chalasr
Copy link
Member

A DSN string can contain the password. Hiding the whole DSN can hurt debugging.

That's ok as long as we manage to reveal the sensitive values in debugging contexts such as the webprofiler, right?

Some functions cannot throw an exception or make an error. Adding the annotation may be useless.

Fine to me as well, as they might do at some point or be extended.

fancyweb reacted with thumbs up emoji

6.2
---

* Hide sensitive information from stack traces with`SensitiveParameter` attribute
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to be more precise about "Hide". It's "only" for back traces.

GromNaN reacted with thumbs up emoji
@fabpot
Copy link
Member

Thank you@GromNaN.

@fabpotfabpot merged commit4a31363 intosymfony:6.2Jul 11, 2022
@GromNaNGromNaN deleted the sensitive-parameter branchJuly 11, 2022 07:15
@fabpotfabpot mentioned this pull requestOct 24, 2022
fabpot added a commit that referenced this pull requestNov 22, 2022
This PR was merged into the 6.2 branch.Discussion----------Add more #[\SensitiveParameter]| Q             | A| ------------- | ---| Branch?       | 6.2| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -Follow-up to#46183Commits-------8ad9642 Add more #[\SensitiveParameter]
nicolas-grekas added a commit that referenced this pull requestJan 19, 2023
This PR was merged into the 6.3 branch.Discussion----------Add #[\SensitiveParameter] to $sessionId| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -Follow-up to#48274 and#46183Commits-------32c9f28 Add #[\SensitiveParameter] to $sessionId
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot left review comments

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

@wouterjwouterjAwaiting requested review from wouterjwouterj is a code owner

@OskarStarkOskarStarkAwaiting requested review from OskarStarkOskarStark is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

6.2

Development

Successfully merging this pull request may close these issues.

6 participants

@GromNaN@javiereguiluz@chalasr@TimWolla@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp