Svelte 4.2.9 represents a minor update to the Svelte framework, building upon the foundation laid by version 4.2.8. Both versions share the core description of "Cybernetically enhanced web apps," highlighting Svelte's commitment to efficient and reactive web development. A key area of interest for developers lies in the dependency updates. While many dependencies remain consistent between the two versions such as acorn, code-red, css-tree, aria-query, periscopic, is-reference, magic-string, estree-walker, locate-character, @ampproject/remapping, @jridgewell/trace-mapping, and @jridgewell/sourcemap-codec, a closer look reveals subtle yet significant changes.
Notably, axobject-query sees an upgrade from version 3.2.1 in 4.2.8 to version 4.0.0 in 4.2.9 suggesting potential enhancements or bug fixes related to accessibility object querying, important for building inclusive web applications. Furthermore, @types/estree is added as a dependency only in the newer version which now has it's dev dependency moved to a simple dependency, probably because it's needed during runtime. Additionally, dts-buddy jumps from version 0.1.7 to 0.4.3 in the newer version. While other dev dependencies are untouched, like jsdom, kleur, agadoo, rollup, vitest, esbuild, happy-dom, tiny-glob, source-map, typescript, @types/node, @playwright/test, @types/aria-query, eslint-plugin-lube, @rollup/plugin-json, @rollup/plugin-commonjs, @sveltejs/eslint-config, @rollup/plugin-node-resolve These tweaks, though seemingly small, could impact build processes, accessibility features, and overall performance. The increase in fileCount for the packaged version to 249 might indicate additional files or refined packaging. Ultimately, developers should review comprehensive changelogs from the Svelte team for detailed information on specific bug fixes, performance improvements, and potential compatibility considerations when upgrading.
All the vulnerabilities related to the version 4.2.9 of the package
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