-
Notifications
You must be signed in to change notification settings - Fork 7.8k
#[\SensitiveParameter] should be inherited if unmodified param is used? #18461
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
Comments
I think this is pointless. You could add an exception for unmodified passing, theoretically. PHP does not really have any sort of tainting (which this effectively is). What you actually want, is changing the |
this sounds like something which could easily be errored about via static analysis. maybe open a feature request at e.g. PHPStan to make it error when parameters attributed |
Agreed. Alternatively, you can pass around a wrapper that hides your value. https://3v4l.org/1ujDU
That seems much worse, no? |
You mean the native As the RFC author and from my experience of using the attribute in practice: It is rare to pass a sensitive value to some “generic function” that does not (and cannot) have the attribute and that also is capable of throwing an exception. Usually you are just passing along a |
The issue isn't in my own code - the problem is in libraries and/or PHP extensions, which I can't change.
No, it's the same. Whether I leak a user's password in the nth or the xth frame of a stack trace doesn't matter. A leak is a leak.
In practice, the more common issue is not that a function that explicitly uses the parameter throws, but something unrelated, but the $password is there as param in the stack trace. e.g.
Currently (and since long before SensitiveParameter was introduced), I'm just scrubbing all sensitive data based on the param name from trace frames in the exception handler. Which made me wonder what the purpose of SensitiveParameter is, when I have to manually scrub it anyway. |
What do you suggest then? Something that is ever passed as a sensitive parameter is forever tainted and will never be shown in stack traces? How do you suggest implementing this, especially without a performance impact?
Maybe that is the root of your issue then. |
Description
https://3v4l.org/VQhiC#v8.4.6
At the moment, SensitiveParameter only makes sense if the function does not pass this parameter to any other function (unless that other function also has SensitiveParameter implemented), as that other function will leak the sensitive parameter anyway.
This creates a false sense of security.
Possible options:
or
The text was updated successfully, but these errors were encountered: