Svelte, a "magical disappearing UI framework," saw a minor version update from 1.20.1 to 1.20.2 on May 6th, 2017. Both versions share the same core description, licensing (MIT), author (Rich Harris), and repository details, indicating a maintenance release rather than a feature-rich update. Examining the devDependencies, we find an identical list of tools used for development and testing. This extensive list includes tools for testing (Mocha, jsdom, nyc, codecov), linting (eslint), bundling (Rollup), transpilation (Babel), and source map generation. Specifically, the Babel plugins suggest support for modern JavaScript features via transpilation to older environments. The presence of rollup-plugin-* hints at Svelte's module bundling strategy.
However, the real update lies in the timing, the releaseDate. Version 1.20.2 was released approximately an hour after 1.20.1. This suggests that the update in 1.20.2 likely addresses a bug fix, a small documentation improvement, or something similarly minor that was deemed important enough to warrant a quick follow-up to the previous release. For developers already using Svelte 1.20.1, upgrading to 1.20.2 is advisable to potentially benefit from immediate bug fixes or stabilizations. The nature of the difference implies no breaking changes or significant new features. If you are starting a greenfield project and choose Svelte as your Javascript Framework, picking the latest stable version is always recommended.
All the vulnerabilities related to the version 1.20.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