Svelte 3.4.2 represents a minor version bump over its predecessor, Svelte 3.4.1, both maintaining the core promise of "Cybernetically enhanced web apps." While the high-level functionality remains consistent, there are subtle differences that could impact developers. The dependency lists for both versions are identical, meaning no tooling changes or breaking updates for build processes when upgrading. The underlying toolchain used for development, including Rollup, TypeScript, and various linting and testing utilities, remains stable across both versions. The file count in the distributed package archives is also the same at 21 files each.
A key difference lies in the unpacked size of the packages. Svelte 3.4.2 weighs in at 1,017,975 bytes, while version 3.4.1 is slightly smaller at 1,014,658 bytes. This suggests that version 3.4.2 includes minor code additions, bug fixes, or performance optimizations compared to the former version. Reviewing the Svelte changelog for this specific version would be advised to get the specifics on changes. Both versions are licensed under the MIT license and were released in May 2019. The biggest difference is the release date with v3.4.2 being released 5 days after the v3.4.1. For developers, sticking with the latest patch version like 3.4.2, is generally advised to leverage the most up-to-date version with all fixes.
All the vulnerabilities related to the version 3.4.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