Svelte 4.2.7 is a minor patch release following closely on the heels of Svelte 4.2.6, both maintaining the core promise of "Cybernetically enhanced web apps." Examining the package data reveals minimal changes focused likely on bug fixes and small improvements. The dependency list remains identical, including crucial libraries such as acorn for JavaScript parsing, css-tree for CSS handling, and magic-string for efficient string manipulation during compilation. The developer tooling, encompassing rollup for bundling, vitest for testing, and typescript for type checking, also remains consistent between the two releases.
While the listed dependencies and devDependencies don't visually showcase a change, the crucial difference lies in the dist section. Version 4.2.7 has a slightly larger unpackedSize and a significantly later releaseDate compared to 4.2.6, suggesting internal refinements or bug fixes. For developers already using Svelte 4, upgrading from 4.2.6 to 4.2.7 is highly recommended to benefit from any underlying stability improvements and potential security patches.
Given the small differences, it's unlikely there are new features or API changes in 4.2.7. Therefore, developers can expect a seamless transition, focusing on the core Svelte experience: writing declarative components that compile to highly efficient vanilla JavaScript. Svelte continues to empower developers to build performant, reactive web applications without the overhead of a heavy virtual DOM, and this minor release reinforces that commitment through subtle but important enhancements.
All the vulnerabilities related to the version 4.2.7 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