Make WordPress Core


Ignore:
Timestamp:
02/03/2025 07:50:50 PM (10 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-wp-xmlrpc-server.php

    r59748 r59754  
    286286     * @return WP_User|false WP_User object if authentication passed, false otherwise.
    287287     */
    288     public function login( $username, $password ) {
     288    public function login(
     289        $username,
     290        #[\SensitiveParameter]
     291        $password
     292    ) {
    289293        if ( ! $this->is_enabled ) {
    290294            $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
     
    331335     * @return bool Whether authentication passed.
    332336     */
    333     public function login_pass_ok( $username, $password ) {
     337    public function login_pass_ok(
     338        $username,
     339        #[\SensitiveParameter]
     340        $password
     341    ) {
    334342        return (bool) $this->login( $username, $password );
    335343    }
Note: See TracChangeset for help on using the changeset viewer.