Svelte 4.1.1 is a minor patch release following 4.1.0 in the Svelte framework, a tool known for building fast and efficient web applications. Both versions share identical dependencies and devDependencies, suggesting that the core functionality and development tooling remain consistent. This includes essential libraries like acorn for JavaScript parsing, css-tree for CSS analysis, and magic-string for efficient string manipulation – all critical for Svelte's compilation process. The development dependencies comprise testing frameworks like vitest and happy-dom along with crucial tools like rollup, esbuild, and typescript for building and type-checking the framework itself.
The key difference lies in the dist metadata, specifically the unpackedSize. Version 4.1.1 is slightly larger, about 1KB more, at 2610762 bytes compared to 4.1.0's 2609712 bytes. This suggests that bug fixes or minor enhancements in 4.1.1 required slightly more code. Though the difference is minimal it is still important to check the changelog to confirm that the new version doesn't break any functionality.
Developers should consider updating to 4.1.1 for potential bug fixes and minor enhancements. Given the identical dependency structure, the upgrade should be seamless, and developers can expect the same familiar Svelte experience. Prior to upgrading it is always a good idea to consult the official Svelte changelog for a detailed list of included fixes and improvements. For developers starting new projects, using 4.1.1 is the recommended choice and ensures they are working with the most up-to-date stable version.
All the vulnerabilities related to the version 4.1.1 of the package
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