Make WordPress Core


Ignore:
Timestamp:
02/03/2025 07:50:50 PM (9 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-admin/includes/upgrade.php

    r59465 r59754  
    4545     * }
    4646     */
    47     function wp_install( $blog_title, $user_name, $user_email, $is_public, $deprecated = '', $user_password = '', $language = '' ) {
     47    function wp_install(
     48        $blog_title,
     49        $user_name,
     50        $user_email,
     51        $is_public,
     52        $deprecated = '',
     53        #[\SensitiveParameter]
     54        $user_password = '',
     55        $language = ''
     56    ) {
    4857        if ( ! empty( $deprecated ) ) {
    4958            _deprecated_argument( __FUNCTION__, '2.6.0' );
     
    564573     *                           usually passed instead of the actual password.
    565574     */
    566     function wp_new_blog_notification( $blog_title, $blog_url, $user_id, $password ) {
     575    function wp_new_blog_notification(
     576        $blog_title,
     577        $blog_url,
     578        $user_id,
     579        #[\SensitiveParameter]
     580        $password
     581    ) {
    567582        $user      = new WP_User( $user_id );
    568583        $email     = $user->user_email;
Note: See TracChangeset for help on using the changeset viewer.