Svelte version 2.5.1 represents a minor update over its predecessor, 2.5.0, within the Svelte UI framework ecosystem. Both versions share the core philosophy of a "magical disappearing UI framework," implying a focus on compile-time transformations for optimal runtime performance. Examining their package.json files reveals nearly identical dependency structures, leveraging tools like Rollup for bundling, ESLint for linting, and TypeScript for development. The development dependencies indicate a robust testing environment, including Mocha and jsdom, suggesting a commitment to code quality.
Key differences lie in the release date and the dist metadata. Version 2.5.1 was released on May 11, 2018, a few days after version 2.5.0, released on May 6, 2018. The unpacked size of version 2.5.1 is slightly larger (2554042 bytes) compared to version 2.5.0 (2553321 bytes), suggesting minor code additions or adjustments. While the dependency list remains consistent, this subtle difference in size and release date hints at bug fixes or small enhancements implemented in the newer patch. For developers, this incremental update assures stability and potentially addresses edge cases encountered in version 2.5.0, while minimizing the risk of introducing breaking changes. The identical dependency manifest further solidifies the nature of 2.5.1 as a conservative and safe upgrade for projects already utilizing Svelte 2.5.0, focusing on incremental improvements.
All the vulnerabilities related to the version 2.5.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