Skip to content

#[\SensitiveParameter] should be inherited if unmodified param is used? #18461

Closed
@kkmuffme

Description

@kkmuffme

Description

https://3v4l.org/VQhiC#v8.4.6

<?php

function some_lib( $auth ) {
    throw new Exception( 'Some error' );
}

function my_code(
    #[\SensitiveParameter] 
    $password
) {
    some_lib( $password );
}

try {
    my_code('hunter2');
} catch ( Throwable $e ) {
    var_dump( $e->getTrace() );
}

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:

  1. if the param is passed to another function call, ignore the sensitive parameter alltogether, since it's pointless just marking it sensitive in 1 trace frame
    or
  2. if the param is used without modification, it should pass on that "sensitive" even to a function, where the param is not marked sensitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions