Svelte version 2.6.1 arrives hot on the heels of 2.6.0, offering subtle improvements and refinements to this popular "disappearing UI framework," without altering its core functionality. Both versions share the same fundamental promise of Svelte: a compiler that transforms your components into highly efficient vanilla JavaScript at build time, resulting in faster application performance and a smaller bundle size for a better user experience.
Developers already familiar with Svelte 2.6.0 will find the upgrade to 2.6.1 seamless. The core development experience remains identical, with a focus on writing concise and declarative components that Svelte cleverly optimizes. The array of devDependencies, crucial for tasks like testing, linting, and bundling during development, remains consistent between the two versions, ensuring a smooth transition for existing projects.
While the list of devDependencies appears extensive, it largely reflects the tooling used to build and test Svelte itself rather than direct dependencies required by Svelte applications. This underscores Svelte's lean runtime and minimal footprint.
The key difference is in the "dist" section of the package metadata. Version 2.6.1 has a slightly larger unpacked size (2585005 bytes) compared to 2.6.0 (2582070 bytes), suggesting minor internal adjustments, bug fixes, or performance tweaks. The release dates also indicate a very quick turnaround, with version 2.6.1 being released merely a day after 2.6.0. This suggests a critical, though likely small, fix was deemed necessary. For developers, upgrading to 2.6.1 is recommended to benefit from these potential improvements, ensuring a more stable and optimized development experience. Svelte's commitment to staying lightweight while providing powerful UI capabilities remains at the forefront with this incremental update.
All the vulnerabilities related to the version 2.6.1 of the package
Svelte vulnerable to XSS when using objects during server-side rendering
The package svelte before 3.49.0 is vulnerable to Cross-site Scripting (XSS) due to improper input sanitization and to improper escape of attributes when using objects during SSR (Server-Side Rendering). Exploiting this vulnerability is possible via objects with a custom toString() function.
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