Svelte is a radical approach to building user interfaces, shifting work from the browser to the compiler, resulting in highly performant web applications. The package data reveals incremental updates between versions 3.0.0 and 3.0.1, showcasing the continuous refinement of this innovative framework.
While both versions share the same core description – "Cybernetically enhanced web apps" – and a comprehensive suite of development dependencies, a closer look reveals subtle but important changes. Both versions include an extensive list of devDependencies that cover most of the steps needed for Javascript/Typescript development.
The dist object, describing the package contents, exposes a slight increase in unpackedSize from 999852 bytes in version 3.0.0 to 1001046 bytes in version 3.0.1. This modest growth indicates minor code additions, bug fixes, or optimizations within the compiler or runtime. The releaseDate also highlights the quick iterative pace, with a new version published just a few days after the previous one. For developers, this quick iteration indicates an active development team that actively supports the project.
For developers deciding whether to update, this data suggests that version 3.0.1 is a recommended upgrade, incorporating potential improvements and fixes without introducing breaking changes in the API (as indicated by incrementing the patch number). Staying current ensures access to the most stable and optimized experience when building Svelte applications.
All the vulnerabilities related to the version 3.0.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