On Mon, Jan 31, 2022 at 11:55 AM Tim Düsterhus, WoltLab GmbH <
duester...@woltlab.com> wrote:

> Hi Internals!
>
> On 1/10/22 15:05, Tim Düsterhus, WoltLab GmbH wrote:
> > https://wiki.php.net/rfc/redact_parameters_in_back_traces
> At the end of last week I've updated the RFC a little based on the
> questions Derick Rethan asked me for episode #97 of PHP Internals News
> podcast:
>
> https://phpinternals.news/97
>
> https://github.com/php/php-src/pull/7921
>
> now adds the \SensitiveParameter attribute to PDO::__construct()'s
> $password parameter and to password_hash()'s $password parameter.
>
>
> I believe I've answered all open questions and I also managed to resolve
> the open issues I listed in my initial email.
>
>
Hey Tim,

I think storing the original value within the replacement value should be
considered and voted in this RFC as well, even if implemented in a separate
PR.
I did write some code where I process programmatically the backtraces and
while I might not have used it with sensitive parameters, it would be good
to have the code generic, if this passes.

I'm guessing that mostly means accepting the value as a constructor
parameter exposing a getValue() method
And, of course, making sure var_dump/print_r/string-casting does not print
it. I mean, it looks like the implementation is doable.

Thinking about this will bring a small issue into plain sight, the
attribute is the same class as the replacing placeholder,
\SensitiveParameter.
I believe they should be separate classes, \SensitiveParameter marked as an
Attribute that can be applied to parameters and something like
\SensitiveParameterValue that replaces the original value  in stack traces.

Regards,
Alex

Reply via email to