Svelte 3.32.2 represents a minor version bump over its predecessor, Svelte 3.32.1, with a focus on internal improvements and dependency updates rather than groundbreaking new features directly affecting developers. Both versions, characterized by the description "Cybernetically enhanced web apps," share the same core philosophy of compiling Svelte components into highly efficient vanilla JavaScript at build time, leading to faster load times and improved runtime performance for web applications.
However, examining the devDependencies reveals subtle differences. One notable change is the updated version of css-tree. In version 3.32.1, css-tree is listed as 1.0.0-alpha22, while in version 3.32.2 it is listed as ^1.1.2. This signifies a version update that likely brings bug fixes and potentially new functionalities or improved CSS parsing capabilities for the Svelte compiler. Furthermore, there's a difference in the dist object, specifically within the unpackedSize. Version 3.32.2 has an unpacked size of 6544352 bytes, whereas version 3.32.1 has an unpacked size of 6363485 bytes. The later version is slightly bigger, possibly due to the updated css-tree package, other internal changes and optimizations, or adjusted build configurations.
For developers, these changes translate to a more robust and reliable development experience. Dependency updates, especially in tools like css-tree, often address security vulnerabilities and improve compatibility with the latest web standards. While the immediate impact might not be directly visible in code, these incremental improvements contribute to the long-term stability and maintainability of Svelte projects.
All the vulnerabilities related to the version 3.32.2 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