close

Make WordPress Core

Changeset 61829


Ignore:
Timestamp:
03/04/2026 08:25:42 PM (9 days ago)
Author:
jorgefilipecosta
Message:

Options: Mask connector API keys on All Options screen.

Connector API keys were visible in plain text on wp-admin/options.php
because it queries the database directly, bypassing the get_option()
filter that normally masks these values.
This adds masking for options matching the connectors_*_api_key pattern
using the existing _wp_connectors_mask_api_key() function, and disables
editing from this screen.

Props jorgefilipecosta, gziolo, ocean90.
Fixes #64793.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options.php

    r61828 r61829  
    424424            $disabled = true;
    425425        }
     426    } elseif ( str_starts_with( $option->option_name, 'connectors_' )
     427        && str_ends_with( $option->option_name, '_api_key' )
     428    ) {
     429        // Mask connector API keys and prevent updates from this screen.
     430        $value    = _wp_connectors_mask_api_key( $option->option_value );
     431        $disabled = true;
    426432    } else {
    427433        $value               = $option->option_value;
Note: See TracChangeset for help on using the changeset viewer.