Svelte 3.9.1 is a minor patch release following closely on the heels of Svelte 3.9.0, both iterations of the popular JavaScript compiler that transforms component code into highly efficient, framework-less vanilla JavaScript. While seemingly incremental, patch updates like 3.9.1 are crucial for stability and often address critical bug fixes that can impact developers' workflows and application performance.
A key difference between the two versions lies in the dist field. Svelte 3.9.1 has a slightly larger unpacked size of 2821512 bytes compared to 3.9.0's 2812752 bytes. This indicates that the patch likely includes small code refinements, optimizations, or potentially even updated dependencies bundled within the package. The file count remains consistent at 194 files but this doesn't mean the content inside the files hasn't changed. Furthermore, Svelte 3.9.1 was released on August 22, 2019, just two days after version 3.9.0 which came out on August 20, 2019, suggesting a quick turnaround to address an immediate issue. Developers should always prioritize using the latest stable version to ensure they benefit from these improvements, reduced issues, and to prevent potential compatibility problems. Checking the changelog on the official Svelte website or GitHub repository would give a more detailed description of the changes. It is important to stay up to date with the newest versions so you can use the most performant and bug-free svelte code available.
All the vulnerabilities related to the version 3.9.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