Svelte version 4.2.5 is a minor update following closely after version 4.2.4, both iterations of this popular JavaScript framework designed for building performant web applications. A quick review of the package information reveals mostly consistency between the two versions. The core dependencies remain identical, featuring crucial libraries like acorn for JavaScript parsing, css-tree for CSS processing, and magic-string for efficient string manipulation – all essential for Svelte's compilation process. Similarly, the developer dependencies used for building and testing Svelte itself are unchanged, ensuring a stable development environment for the Svelte team. These include tools like rollup for bundling, vitest for unit testing, and typescript for type checking.
Notably, both versions share the same license (MIT), author (Rich Harris), and repository details, indicating continuity in the project's governance and maintenance. The slight difference in unpacked size (2,630,660 bytes vs 2,628,882 bytes) and release date (less than a day apart and as of November 2023) hints at minor bug fixes or performance tweaks implemented in 4.2.5. Developers upgrading from 4.2.4 should anticipate a seamless transition, as the core functionalities and APIs are expected to be entirely compatible. Check the official Svelte changelog for a detailed list of specific fixes or improvements within this incremental update, ensuring optimal application stability and performance. Svelte continues to empower developers with its reactive and component-based approach to web development, promising efficient and intuitive coding experience.
All the vulnerabilities related to the version 4.2.5 of the package
Svelte has a potential mXSS vulnerability due to improper HTML escaping
A potential XSS vulnerability exists in Svelte for versions prior to 4.2.19.
Svelte improperly escapes HTML on server-side rendering. It converts strings according to the following rules:
"
-> "
&
-> &
<
-> <
&
-> &
The assumption is that attributes will always stay as such, but in some situation the final DOM tree rendered on browsers is different from what Svelte expects on server-side rendering. This may be leveraged to perform XSS attacks. More specifically, this can occur when injecting malicious content into an attribute within a <noscript>
tag.
A vulnerable page (+page.svelte
):
<script>
import { page } from "$app/stores"
// user input
let href = $page.url.searchParams.get("href") ?? "https://example.com";
</script>
<noscript>
<a href={href}>test</a>
</noscript>
If a user accesses the following URL,
http://localhost:4173/?href=</noscript><script>alert(123)</script>
then, alert(123)
will be executed.
XSS, when using an attribute within a noscript tag