-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte exposing all existing routes in build output #10072
Comments
This is just how SvelteKit works. FWIW, other frameworks (Next.js included) also do this. I believe Next.js doesn't as of v13, but it still exposes route data in other ways (it's an active area of exploration). It's just required for client-side routing. I believe we've talked about ways to get around this, but we don't have any plans to change it currently.
If that's so, it's a shame, but I'm not really sure why -- if you're relying on your route names being "secret" as part of your security plan, you're relying on security through obscurity, and it's going to bite you. Your secure routes should be secure, whether or not users are aware of them. |
Thank you for your answer. 🙏 I am aware that other frameworks do this too, and I am surprised that so little people see this as a problem, or at least as a 'minor vulnerability'. (edit: NextJS 13 doesn't do this actually)
Obscuring routes is of course not 'the solution', but at least a first defence. In any case, serving a detailed floormap on a silver platter is not particularly helping. So what (reasonable) solutions could there be, if I don't want to expose all existing admin routes that are behind an auth? |
Not really any that I can think of. There's the unreasonable solution of implementing all of your authed routes as a single catchall route and serving them from The whole point is, any version of "please hide my routes so users don't know what they are" is a security through obscurity argument. It might be nice to have in some cases (routes to feature-flagged content are one that comes to mind), but it breeds a false sense of security. If your site isn't secure to users who know where your routes are, it's not secure to users who don't know where your routes are, either. |
I mean, if they were to discover the In the search for a solution... Since this is all needed for client side routing, is there a (config setting) way to disable this all together or on a per-route basis? (In the hopes that this will also prevent these routes to be exposed in the buildfile). This being a trade-off of course, but one that might be acceptable to a certain business case. |
You can obfuscate your build. |
Describe the bug
When building your app, in the generated build files, Svelte is exposing all the existing routes. Even the routes that might be behind auth. Even though the users will not be able to see the contents of a page, it might expose sensitive data that you don't want to be publicly visible.
For example:
It's like having a lock on your door, but providing a thief 🥷 with a detailed floorplan 🗺️ of the house.
I am unable to find a config setting that prevents this behaviour. To me, this makes SvelteKit a no-go to use. Which would be a pity.
Reproduction
Build the app, use Chrome, go to the Web Inspector > Sources > _app/immutable/entry/app.xxxxx.js
At the bottom of this file (in my case) you can see all the exposed urls.
Logs
No response
System Info
Severity
blocking all usage of SvelteKit
Additional Information
No response
The text was updated successfully, but these errors were encountered: