Mark parameters containing user credentials as sensitive #878
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PHP 8.2 introduced the
SensitiveParameter
attribute.The effect of the attribute is that the value of the parameter is no longer directly shown in stack traces; instead, starting with PHP 8.2, the parameter will be presented as a
SensitiveParameterValue
object.As the attribute only applies to parameters, it (unfortunately) has no effect on serialization of the object. See: https://3v4l.org/StoQO Might be an idea to start a discussion about an
SensitiveProperty
attribute on the PHP Internals mailing list, but that's outside the scope of this PR.For now, this PR marks the
$args
parameter for theAuth\Basic
class constructor and theProxy\Http
constructor as sensitive as both of these are supposed to contain user credentials (user name, password) for accessing a protected URL.Includes updating the example code for custom authentication to also use the attribute.
Open question
The
$options
array passed to a large range of Requests methods can also contain credentials. Should this parameter also be marked as sensitive in all appropriate places ?Refs: