Svelte version 4.0.3 represents a minor update over its predecessor, 4.0.2, both iterations built upon the foundation of Svelte's promise of "Cybernetically enhanced web apps." Examining the package data reveals that the core dependencies remain identical, encompassing vital tools like acorn for JavaScript parsing, css-tree for CSS manipulation, and magic-string for efficient source code modification. Similarly, the development dependencies, which include testing frameworks like vitest and happy-dom, bundlers like rollup and esbuild, and TypeScript-related tooling, are consistent between the two versions. This stability suggests that the update likely focuses on bug fixes, performance improvements, or minor feature enhancements, rather than a significant overhaul of the underlying architecture.
While a direct changelog is needed for precise details, the key difference appears in the dist section, specifically the unpackedSize. Version 4.0.3 has a slightly larger unpacked size (2621865 bytes) compared to 4.0.2 (2621840 bytes). This increase, though small, hints at possible code additions or modifications. The release date indicates a same-day release, with 4.0.3 being published after 4.0.2, further supporting the scenario of a quick patch or refinement. The file count is the same though so likely it is just minor size diference. For developers, upgrading from 4.0.2 to 4.0.3 should be relatively painless, given the shared dependency structure. However, it's always recommended to review official release notes or commit history for a comprehensive understanding of the changes implemented and assess if any updates might impact your specific application or project.
All the vulnerabilities related to the version 4.0.3 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