Svelte version 2.9.3 represents a minor patch release over its predecessor, 2.9.2, within the Svelte 2.x series, a period known for solidifying the framework's core principles of compile-time UI creation. Both versions maintain the core ethos of being a "magical disappearing UI framework," emphasizing performance by shifting much of the UI rendering work to the compile step, reducing the runtime overhead significantly compared to traditional virtual DOM approaches.
The key differences between these versions are primarily in bug fixes and minor improvements, not in significant feature rollouts. While the extensive list of devDependencies remains mostly unchanged, reflecting the robust tooling ecosystem supporting Svelte's development, the critical update lies in the increase of the unpacked size from 2572289 to 2573129. This slight increment usually indicates small bug fixes and internal optimizations.
Developers utilizing Svelte in their projects should note the release date difference, as 2.9.3 was released shortly after 2.9.2, likely to address immediate issues discovered in the previous version. This suggests that upgrading to 2.9.3 is recommended for stability and to benefit from the latest refinements. From a developer perspective, both versions offer a component-based approach to building web applications, with Svelte compiling components into highly efficient vanilla JavaScript during build time. Svelte focused on minimizing runtime overhead and improving initial load times. This makes this 2.x series appealing for projects where front-end performance is a priority.
All the vulnerabilities related to the version 2.9.3 of the package
Svelte vulnerable to XSS when using objects during server-side rendering
The package svelte before 3.49.0 is vulnerable to Cross-site Scripting (XSS) due to improper input sanitization and to improper escape of attributes when using objects during SSR (Server-Side Rendering). Exploiting this vulnerability is possible via objects with a custom toString() function.
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