Svelte 4.1.0 represents a minor yet notable update to the Svelte JavaScript framework, building upon the foundation laid by version 4.0.5. Both versions share the same core dependencies like acorn, code-red, and css-tree, ensuring continued compatibility and feature parity in areas like AST parsing, code transformation, and CSS processing. However, several key development dependencies have been updated, reflecting improvements in the tooling ecosystem. Specifically, rollup has been updated from version 3.25.1 to 3.26.2, vitest from 0.31.4 to 0.33.0 and esbuild from 0.17.19 to 0.18.11. These dependency upgrades likely bring performance enhancements, bug fixes, and new features to the build process, benefiting developers with faster build times and improved debugging capabilities. While file count remained consistent, the unpacked size decreased slightly from 2622094 to 2609712, suggesting possible optimizations in the codebase or build process. The release date of 4.1.0, July 19, 2023, indicates a focus on recent improvements and refinements to the framework. Developers considering upgrading should evaluate the updated rollup, vitest and esbuild to ensure compatibility with their existing projects and leverage any performance improvements they offer. Svelte continues with the same MIT license, thus free to use in personal and commercial projects. This incremental update signifies Svelte's commitment to stability, performance, and a modern development experience through continuous improvement of underlying tools.
All the vulnerabilities related to the version 4.1.0 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