Svelte version 0.2.2 builds upon the foundation laid by its predecessor, version 0.2.1, continuing the evolution of this "magical disappearing UI framework". Both versions share the same core description, highlighting Svelte's innovative approach to web development, where the framework shifts the workload from the browser to the compile time, resulting in highly optimized and performant applications. The developer dependencies remain consistent between the two releases, signaling a focus on stability and refinement of the development process. Key tools like Rollup for bundling, ESLint for code quality, and Mocha for testing are all present, indicating a robust and well-supported development environment. The consistent dependency list between versions suggests that the core development workflow and testing methodologies remain unchanged.
The crucial distinction lies in the release date. Version 0.2.2 was released just about 35 minutes after version 0.2.1 which indicates a hotfix or a very small change. For developers, this may mean bug fixes, or quick patches to the code that were adressed in the new release. While a minor version bump usually signifies new features, the close release proximity points to a more urgent need to address issues uncovered in version 0.2.1. Those interested in Svelte for their projects should consider this rapid iteration as a positive sign of a quick response to identifying and resolving issues. Investigating the commit logs between these two versions (available on the Svelte GitHub repository) would provide further clarity on the precise nature of these changes and inform the decision to upgrade.
All the vulnerabilities related to the version 0.2.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