Svelte version 4.1.2 represents a subtle but noteworthy update over its predecessor, 4.1.1 in the ongoing evolution of this popular JavaScript framework for building reactive web applications. While both versions share the same core dependencies, suggesting a continuous commitment to underlying tools for code transformation (like acorn, code-red, css-tree), accessibility support (aria-query, axobject-query), and source map handling (@jridgewell packages), the key distinction lies in the release date and potentially subtle bug fixes or performance enhancements. Version 4.1.2 was released on July 31, 2023, approximately 11 days after 4.1.1 which was released on July 20, 2023. This suggests a responsive approach to addressing issues or incorporating minor improvements identified in the earlier release.
For developers, the upgrade from 4.1.1 to 4.1.2 should be relatively seamless, given the identical dependency structure. However, it's advisable to consult the official Svelte changelog for a comprehensive list of specific changes, especially bug fixes. The development dependencies, encompassing testing frameworks (like vitest, happy-dom, @playwright/test) and build tools (such as rollup, esbuild), remain consistent, assuring a stable development environment for Svelte projects. Both version share the same number of files, 247, but a slight increase in unpacked size (2,610,843 vs 2,610,762). While minimal, this difference in size can point at code improvements.
All the vulnerabilities related to the version 4.1.2 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