Plugin Directory


Ignore:
Timestamp:
10/27/2026 04:42:52 AM (30 hours ago)
Author:
softminal
Message:

Release 1.1.1: multisite security fixes for the CDN address and the shared Cloudflare token

File:
1 edited

Legend:

Unmodified
Added
Removed
  • softminal-cache/trunk/app/Cache/Config.php

    r3763679 r3767752  
    33namespace SoftminalCache\App\Cache;
    44
     5use SoftminalCache\App\Modules\Cdn;
    56use SoftminalCache\App\Core\Compat;
    67use SoftminalCache\App\Core\Modules;
    … …  
    243244            $merged['modules'] = Modules::sanitize($input['modules'], $before['modules']);
    244245        }
    245         $settings = self::sanitize($merged);
     246        $settings = self::keepCdnUrls($before, self::sanitize($merged));
    246247        update_option(self::OPTION, $settings);
    247248        Snapshots::record($before, $settings, $label);
    … …  
    262263    {
    263264        $before   = self::get();
    264         $settings = self::sanitize($settings);
     265        $settings = self::keepCdnUrls($before, self::sanitize($settings));
    265266        update_option(self::OPTION, $settings);
    266267        Assets::sync($before, $settings);
    267268        self::writeRuntime();
    268269        ServerRules::sync($settings);
     270
     271        return $settings;
     272    }
     273
     274    /**
     275     * The CDN addresses stay as they were when the current user may not change them (see
     276     * Cdn::mayChangeUrls()), whichever way the change came: the screen, a profile, an import, Undo.
     277     *
     278     * @param Settings $before
     279     * @param Settings $settings
     280     * @return Settings
     281     */
     282    private static function keepCdnUrls(array $before, array $settings): array
     283    {
     284        if (!Cdn::mayChangeUrls()) {
     285            $settings['modules']['cdn']['urls'] = $before['modules']['cdn']['urls'] ?? [];
     286        }
    269287
    270288        return $settings;
Note: See TracChangeset for help on using the changeset viewer.