Svelte 3.22.0 introduces subtle yet impactful refinements over its predecessor, version 3.21.0, solidifying its position as a leading choice for building performant web applications. While the core functionality remains consistent, a few key distinctions warrant consideration for developers.
Looking at the devDependencies section, both versions share an identical set of tools, indicating no changes in the development environment or build process. This consistency ensures a seamless upgrade for developers already working with Svelte.
The dist object reveals a slight increase in unpackedSize from 3126547 to 3134142, suggesting minor additions or modifications to the core library. While seemingly small, this difference hints at internal improvements or bug fixes. Developers should investigate the Svelte changelog for detailed information on these specific changes.
The most notable difference lies in the releaseDate, with version 3.22.0 being released on May 3, 2020, subsequent to the April 24, 2020 release of version 3.21.0. This temporal gap signifies a concentrated effort to address potential issues, incorporate community feedback, or introduce incremental enhancements.
For developers using Svelte, upgrading to version 3.22.0 appears to be a safe and potentially beneficial choice, bringing the latest bug fixes and optimizations to their projects. Keep an eye on the official release notes to fully leverage the changes made in this version.
All the vulnerabilities related to the version 3.22.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