Svelte version 3.18.2 introduces subtle but important refinements for developers building cybernetically enhanced web applications. Compared to its predecessor, 3.18.1, this release includes changes reflected in a slightly increased unpacked size (3,074,125 bytes vs 3,067,892 bytes) and file count (209 vs 208), hinting at internal code adjustments and potential feature enhancements or bug fixes. The release date difference of approximately two weeks suggests the updates were likely addressing specific issues or incorporating minor improvements discovered since the prior version.
A key difference lies in the "code-red" dependency, shifting from version "0.0.32" in 3.18.1 to "0.1.1" in 3.18.2. Code-red is a tool used for analyzing and manipulating JavaScript code, and this upgrade potentially brings performance improvements, new analysis capabilities, or bug fixes within Svelte's compilation pipeline. This could translate to faster build times, more efficient generated code, and improved developer experience. While the core dependencies remain largely consistent, the nuanced updates within the development toolchain underscore Svelte's commitment to continuous improvement in both its performance and the developer tooling around it. Developers upgrading should be mindful of potential impacts stemming from the code-red update, though the Svelte team likely ensured a smooth transition.
All the vulnerabilities related to the version 3.18.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