Svelte version 2.13.1 is a patch release following closely after version 2.13.0. Both are iterations of the "magical disappearing UI framework," emphasizing Svelte's core principle of compiling components into highly efficient vanilla JavaScript during build time rather than in the browser. This approach results in faster load times and improved performance compared to traditional UI frameworks. Examining the package.json files, the devDependencies remain identical between the two versions, suggesting that the changes are unlikely to concern new features or updates to the build process. The libraries range from testing tools (mocha, nyc, jsdom) and linting (eslint) to module bundlers(rollup) and utilities for working with javascript (acorn, magic-string, estree-walker).
The key difference lies in the dist attribute. Svelte 2.13.1 has a slightly larger unpackedSize (1013662 bytes) compared to 2.13.0 (1013546 bytes). The release date also reflects this, with 2.13.1 being released later than 2.13.0. This indicates that version 2.13.1 likely includes bug fixes or minor adjustments that did not necessitate changes to the core development dependencies. For developers, this suggests that upgrading from 2.13.0 to 2.13.1 is recommended to benefit from these fixes, ensuring a more stable and reliable development experience, improving the final product the user interacts with and diminishing risk of issues.
Given the minimal change, the effort to upgrade should be low, while offering potential robustness enhancements.
All the vulnerabilities related to the version 2.13.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