Svelte is a UI framework known for its "disappearing" nature, compiling code to highly efficient vanilla JavaScript at build time. Analyzing versions 2.13.4 and 2.13.3 reveals subtle but potentially important differences for developers. Both versions share identical development dependencies, including tools for testing (Mocha, nyc), linting (eslint), bundling (rollup), and TypeScript support. This suggests a consistent development environment and commitment to code quality.
The key discrepancies appear in the dist object. Version 2.13.4 has a fileCount of 12 and an unpackedSize of 1015947 bytes, while version 2.13.3 has a fileCount of 15 and an unpackedSize of 1034016 bytes. This suggests that version 2.13.4 might have a slightly leaner build, potentially offering marginal improvements in initial load time for applications. Though the difference in unpacked size is relatively small, any reduction is generally welcomed. The release dates also differ, with 2.13.4 being released later on the same day as 2.13.3. This indicates a quick patch or minor update. Developers should investigate the changelogs between these versions; while the dependency list remained the same, the core compiler or runtime logic might have been tweaked to fix bugs or improve performance. While the difference is minimal, always reviewing the specific changes is recommended before upgrading.
All the vulnerabilities related to the version 2.13.4 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