Make WordPress Core


Ignore:
Timestamp:
02/03/2025 07:50:50 PM (4 months ago)
Author:
johnbillion
Message:

Security: Add the SensitiveParameter attribute to sensitive parameters.

Values passed to parameters with this attribute will be redacted if present in a stack trace when using PHP 8.2 or later. This reduces the chance that passwords and security keys get accidentally exposed in debug logs and bug reports.

Props petitphp, TobiasBg, jrf, johnbillion.

Fixes #57304

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wpdb.php

    r59159 r59754  
    750750     * @param string $dbhost     Database host.
    751751     */
    752     public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
     752    public function __construct(
     753        $dbuser,
     754        #[\SensitiveParameter]
     755        $dbpassword,
     756        $dbname,
     757        $dbhost
     758    ) {
    753759        if ( WP_DEBUG && WP_DEBUG_DISPLAY ) {
    754760            $this->show_errors();
Note: See TracChangeset for help on using the changeset viewer.