Svelte 3.40.3 represents a minor version update to the popular Svelte JavaScript framework, building upon version 3.40.2. Both versions share the core features that make Svelte attractive to developers: its approach to building web applications by shifting work into a compile step, resulting in highly performant and lightweight JavaScript code. They aim to provide cybernetically enhanced web apps.
Examining the package metadata, the primary difference lies in the dist section. Version 3.40.3 has a slightly larger unpacked size, 6884718 bytes compared to 6880126 bytes in version 3.40.2. This suggests that the newer version includes some code adjustments, bug fixes, or potentially small feature enhancements which may improve speed and performance. Both versions contain 230 files. The release dates also highlight the versions' proximity; 3.40.3 was released on July 26, 2021, just days after 3.40.2 (July 23, 2021). It's important to upgrade to the latest version since it includes the last improvements.
Svelte relies on a suite of development dependencies, encompassing tools for testing (mocha, jsdom, c8), linting (eslint), bundling (rollup), and TypeScript support. The core dependencies remain consistent between the two versions, indicating that the fundamental build and development pipeline wasn't drastically altered during this minor release. Svelte continues to be licensed under the MIT license with code managed in the sveltejs/svelte GitHub repository. Both package versions are authored by Rich Harris. Developers should check the Svelte changelog for detailed specifics regarding the changes introduced in version 3.40.3.
All the vulnerabilities related to the version 3.40.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