-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Context
Tools like Wappalyzer use heuristics to determine which technologies are used on a given page. Some of them can be a bit brittle. For example Svelte is detected via the svelte-
CSS scoping classname prefix...
"dom": "[class*='svelte-']"
...which only works for apps that use Svelte's built-in CSS scoping (rather than, say, Tailwind). This mechanism is also subject to change in future, at which point the heuristic will fail.
There's also no way to know which version of Svelte (or SvelteKit) is running. This information is potentially useful (hypothetical use cases: devtools, tracking the speed of adoption of new versions, reaching out to sites that are running a version with a known vulnerability) and, in fact, the CWV tech report plans to add version information to the report in future. Currently, Svelte is systematically underrepresented in reports of technology usage, and will be excluded altogether from these more granular reports.
The question under discussion here is whether Svelte and SvelteKit should expose information about whether they're being used on a given page, and if so, whether they should expose which versions are in use.
Security and privacy
Of course, exposing version information provides potential attackers with information about which sites to target, if a version with a known vulnerability exists. Having said that, both client-side libraries and servers have been exposing version information for many years (see e.g. a default Apache 404 page, or log _.VERSION
on any site running Underscore), and to my knowledge this isn't a practice that's frowned upon.
If we do deem granular version information to be too sensitive, then there are alternatives (which might differ between Svelte and SvelteKit — for example we could provide major/minor/patch for Svelte but only major for SvelteKit):
- expose nothing
- expose a boolean ('this site is running some version of Svelte/SvelteKit')
- expose a major version ('this site is running Svelte 4 and SvelteKit 2')
- expose major/minor
- expose major/minor/patch
Crucially, an explicit mechanism (as opposed to a heuristic based on implementation details) can have an opt-out mechanism, so exposing the boolean is arguably more privacy/security conscious than the status quo (and certainly not less).
For this to be at all useful, it would have to be opt-out rather than opt-in.
Implementation
For Svelte, we could add something like this to an internal module...
// svelte/internal/tracking.js
(window.__svelte_versions ??= []).push(VERSION);
...and then import that module in every compiled component (unless the compiler were configured to opt out):
import 'svelte/internal/tracking';
For SvelteKit, it would be natural to use the <meta name="generator">
tag, which is used by things like Wordpress:
<meta name="generator" content="SvelteKit 1.20.0">
Should we do this?
The consensus among maintainers was that exposing a boolean (with an opt-out) for both Svelte and SvelteKit would make sense, since it would simply be a more reliable and privacy-forward version of existing detection mechanisms. We're undecided about whether or not we should expose version information, however.
It's important to us that decisions like these happen with the community's consent and consultation, so we'd very much welcome your thoughts on this question.
This post has been edited, so the first couple of replies might not make much sense