Svelte is a UI framework celebrated for its "disappearing" act – it compiles components to highly efficient vanilla JavaScript at build time, resulting in faster load times and improved runtime performance compared to traditional virtual DOM approaches. Versions 2.15.2 and 2.15.3 are relatively close, but even small updates can bring valuable improvements.
Examining the data, the primary difference between Svelte 2.15.2 and 2.15.3 lies in their release dates and potentially associated bug fixes or minor enhancements. Version 2.15.3 was released on November 6, 2018, a couple of days after 2.15.2. Noticeable too is a small increase in unpacked size from 967730 to 967991. While the core devDependencies remain identical, suggesting no major tooling changes, this size difference indicates that the later release potentially introduces some code updates which could represent internal code refinement, bug fixes, improved performance, or subtle feature adjustments.
For developers, this means upgrading to 2.15.3 is likely a safe and beneficial move. Given the identical dependency list covering tools like Rollup, TypeScript, and ESLint, compatibility shouldn't be a concern. It's always good practice to consult the official Svelte changelog or release notes (if available) for fine-grained details on what was specifically addressed or enhanced in the version 2.15.3 update.
All the vulnerabilities related to the version 2.15.3 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