The vulnerability is a path traversal and arbitrary file read issue caused by improper handling of symbolic links in uploaded PWA icon archives. The core of the vulnerability lies in the processPWAZip function, which is exposed via the /api/pwa/process-zip API endpoint to users with builder permissions.
The processPWAZip function failed to properly validate the contents of the uploaded zip file. It used fs.existsSync to check for the existence of icon files specified in icons.json. Since fs.existsSync follows symbolic links, an attacker could create a zip file containing a symlink pointing to a sensitive file on the server, such as /data/.env. The validation would pass because the target file exists.
After the flawed validation, the processPWAZip function would invoke the objectStore.save function, passing the path to the symlink. The save function would then read the file from the provided path using fsp.open, which also follows symlinks. This resulted in the contents of the sensitive file being read and saved to the object store, making them accessible to the attacker.
The patch rectifies this by replacing fs.existsSync with fsp.lstat (which does not follow symlinks) and fsp.realpath within the processPWAZip function. This ensures that any provided icon path is a regular file and its canonical path is confined within the temporary extraction directory, thus mitigating the vulnerability.