Svelte 3.20.1 is a minor patch release following version 3.20.0 of the Svelte JavaScript framework, a tool designed for building fast, cybernetically enhanced web applications. Both versions share the same core development dependencies, indicating no changes were required in the underlying build or testing infrastructure. The devDependencies listed, encompassing tools like Rollup, TypeScript, ESLint, and various plugins, remain consistent, ensuring a stable development environment for the Svelte team.
The key difference lies in the dist metadata, specifically the unpackedSize. Svelte 3.20.1 has a slightly larger unpacked size (3,119,755 bytes) compared to 3.20.0 (3,119,648 bytes), suggesting minor code-level adjustments or bug fixes. While seemingly small, this increase hints at potential improvements in performance, stability, or security. Developers should consider upgrading to 3.20.1 to benefit from these refinements, as patch releases often address critical issues discovered in the previous version. Moreover, the release date of 3.20.1 is a day later than 3.20.0, indicating a quick turnaround in addressing any immediate concerns. For those already using Svelte, upgrading is recommended. For new users, starting with the latest version (3.20.1) provides the most up-to-date and potentially optimized experience.
All the vulnerabilities related to the version 3.20.1 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