Svelte, the magical disappearing UI framework, saw a minor but notable update with version 0.0.2, building upon the initial foundation laid by version 0.0.1. Both versions share the core promise of a UI framework that shifts the workload from the browser to the compile step, resulting in highly performant and lightweight web applications. Rich Harris remains the author for both.
The key improvements in version 0.0.2 center around enhanced tooling and internal structure. Developers will appreciate the introduction of magic-string and estree-walker as dependencies, facilitating more robust source code transformation and manipulation capabilities within Svelte's compilation process. A new rollup-plugin-node-resolve was added making node dependency resolution easier. The repository URL has changed to github from gitlab.
While the core dependencies like acorn and locate-character remain consistent between the two versions, the addition of these new development dependencies signifies a move towards a more sophisticated and streamlined development workflow for Svelte itself. This, in turn, promises to translate to a better developer experience for those building applications with Svelte.
For developers considering adopting Svelte, the move to version 0.0.2 signals a step forward in the framework's evolution. The underlying goal remains the same: to simplify UI development and optimize performance, but this release is more prepared. While still early in its lifecycle, this update showcases a commitment to refining the build process and empowering developers with better tools for creating performant web applications.
All the vulnerabilities related to the version 0.0.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