Svelte 3.11.0 represents a minor version update to the popular Svelte JavaScript framework, building upon version 3.10.1. Both versions share the core characteristics that make Svelte appealing to developers: a component-based approach, reactive updates, and a focus on generating highly optimized JavaScript at compile time, leading to excellent performance in the browser. Key developer benefits remain consistent across both versions, including simplified state management, reduced boilerplate code compared to traditional frameworks, and enhanced SEO friendliness thanks to server-side rendering capabilities.
However, looking at the metadata provided reveals subtle differences. While the devDependencies lists are identical suggesting no tooling changes in this release, the dist fields reveal a size increase: the unpackedSize jumps from 2,814,103 bytes in 3.10.1 to 2,818,392 bytes in 3.11.0. Though seemingly small, this ~4KB increase is quite considerable considering the size of the library. A developer could infer that the update likely encompasses bug fixes, performance enhancements within the core runtime, or potentially new features with a corresponding increase in code footprint. While granular specifics aren't available without examining the changelog – its abscence is indicative of a patch release rather than feature one –, users can expect general improvements to stability and speed. The slight change in releaseDate, with 3.11.0 being released approximately 2.5 hours after 3.10.1, further supports minor patch or bug fix-related improvements.
All the vulnerabilities related to the version 3.11.0 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