Svelte 3.31.0 and 3.30.1 are both versions of the Svelte JavaScript compiler, designed to build cybernetically enhanced web applications. Looking at the metadata of these releases reveals that both share identical descriptions, licenses (MIT), repository information, and author (Rich Harris). Furthermore, the devDependencies field appears unchanged between releases, indicating that the development tools and testing frameworks used during Svelte's development remained consistent. This includes crucial tools like Rollup for bundling, ESLint for code linting, TypeScript for type checking, and various Rollup plugins for specific functionalities such as JSON processing or code transformation.
The key differences lie in the version numbers (3.31.0 vs. 3.30.1), release dates, and distribution details. Svelte 3.31.0 was released on December 2nd, 2020, while 3.30.1 came out on November 30th, 2020. The unpacked size of 3.31.0 (6270733 bytes) is marginally larger than 3.30.1 (6265499 bytes).
For developers, this suggests that Svelte 3.31.0 likely incorporates bug fixes, performance improvements, or minor feature additions compared to 3.30.1. While the dependency list and core development workflow remained constant, the increment in version number signals changes within the compiler itself. Keeping up with these minor releases allows developers to take advantage of the latest optimizations and resolved issues, leading to a smoother and more efficient development experience when building web applications with Svelte. Developers should review the changelog for a comprehensive list of changes.
All the vulnerabilities related to the version 3.31.0 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