Svelte version 2.9.10 introduces several dependency updates, offering developers potential performance improvements and bug fixes inherited from those updated tools. Key changes in devDependencies include upgrades to nyc (from 11.7.1 to 12.0.2), eslint (from 4.19.1 to 5.3.0) and typescript (from 2.8.3 to 3.0.1), rollup (from 0.58.1 to 0.63.5). magic-string also gets a bump (from 0.24.0 to 0.25.0). These updates may bring improvements to the development experience, such as better code linting and faster build times, crucial for larger Svelte projects. The updated TypeScript version might enable developers to leverage newer language features when building components.
The jump in rollup version is particularly noteworthy as it's a core build tool for Svelte applications, often bringing significant performance and stability enhancements. While the core Svelte library's functionality likely remains consistent, these underlying toolchain improvements contribute to a smoother and more efficient development workflow. Developers upgrading should review the changelogs for each updated devDependency to understand any potential breaking changes or new features introduced. The file count in the distributed package also slightly decreases, potentially indicating minor optimizations in the published files. Furthermore, developers benefit from enhanced type checking capabilities resulting from the Typescript upgrade, thus reducing runtime errors.
All the vulnerabilities related to the version 2.9.10 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