Svelte version 3.5.1 is a minor patch release following 3.5.0 in the Svelte framework, a tool known for building web applications that shift much of the work into a compile step, resulting in highly performant, lightweight JavaScript. Both versions maintain the core promise of "Cybernetically enhanced web apps", highlighting Svelte's focus on optimizing the developer experience and end-user performance. The key difference lies in potential bug fixes and very minor improvements introduced in 3.5.1, addressing any issues discovered in the initial 3.5.0 release, ensuring a more stable development experience for developers. Both versions share an identical set of development dependencies, showcasing a consistent build and testing pipeline, reliant on tools like Rollup for bundling, Typescript for type checking, and ESLint for code quality. This consistent tooling provides a stable environment for Svelte development. While the core functionality remains the same, upgrading to version 3.5.1 is recommended for developers seeking the most stable and refined experience, especially if encountered any issues with version 3.5.0. The tiny unpacked size difference of about 30 bytes might represent small differences in compiled outputs or minimal inclusions. Both versions maintain the same MIT license and the same author, Rich Harris which assures developers of the project's commitment to open-source principles.
All the vulnerabilities related to the version 3.5.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