Svelte version 1.11.1 is a minor patch release following 1.11.0, both versions of the Svelte framework offer a compelling approach to building user interfaces, distinguished by its "disappearing" nature. This means that instead of shipping a large runtime library to the browser, Svelte compiles your components into highly optimized vanilla JavaScript during the build process. This results in smaller bundle sizes and improved performance, benefiting end-users with faster load times and a smoother interactive experience. Both versions 1.11.0 and 1.11.1 share the same core dependencies, including "magic-string" for efficient code manipulation.
Examining the data, the primary distinction lies in the release date. Version 1.11.1 was published on March 8, 2017, a day after 1.11.0. Such a quick release cycle is an idication to bug fixes. The dependency structure reveals the sophisticated toolchain Svelte relies on for development, including testing libraries like "mocha" and "jsdom", linting via "eslint", transpilation using "babel", and bundling through "rollup". Developers will be familiar with these tools, ensuring a seamless integration into existing workflows. Both versions support modern JavaScript features and include specific Babel plugins to transform ES2015 code. For developers seeking a framework that prioritizes performance and a lean output, either version provides a solid foundation. Developers should check the Svelte changelog of the version 1.11.1 to understand the reasons behind the release.
All the vulnerabilities related to the version 1.11.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