Replies: 1 comment
|
Confirmed on 0.1.3-alpha.1 — your three curls reflect exactly what the code does, and it's layering, not an oversight. That means option 1 (gate every plugin route) would be the wrong default, and not one you'd actually want either — the in-repo counter-example is Your sharpest point is the real gap though: a plugin that wants the session gate has no supported way to get it, since the browser-session credential and token are process-private and Connection exposes no way to opt a handler in. "Document it loudly" is cold comfort for write-route authors who have no tool to be safe with. So I'd push option 2, hung on Connection rather than the carrier: a wrapper that hands a plugin handler the same |
Uh oh!
There was an error while loading. Please reload this page.
Question
Since the browser-session auth landed (per-boot
?token=URL + HMACdsh-auth-cookie, enforced inpackages/client/connection/src/browser-auth.ts), all Host Connection requests are gated byisAuthenticated()— 401 otherwise. Routes that plugins register through the webserver entry (webServer.register(),@deepseek-ai/dsh-host-webserver→packages/api/gateway) appear to sit on a separate handler chain that never passes this gate, so they answer unauthenticated on the same port.Is this intended (i.e. plugin routes are the plugin own auth responsibility), or should the session gate cover them? If it is intended, would you consider exposing an opt-in so plugins can require the same browser session — right now the token is process-private (printed to console only), so a plugin cannot validate anything by itself.
Reproduction (dsh-v0.1.3-alpha.1, source checkout, web profile, Windows)
With a fresh boot printing
dsh web: http://127.0.0.1:3080/?token=...:Our plugin (dsh-plugin-lookatstudy) registers
/lookatstudy/api/*viawebServer.register(); without any cookie or token, GET returns the full learning state and the POST routes (activate / mode / focus / delete) process writes.Scope / risk assessment
Low, we believe: the web server binds 127.0.0.1 (LAN unreachable), and the data behind our routes is low-sensitivity learning progress. The residual exposure is local processes and cross-site CSRF-style blind writes from webpages (reads are CORS-blocked; writes are not). The same reasoning presumably applies to any plugin exposing state or write routes this way.
Minimal fix options (in the order we would prefer)
isAuthenticated()session check to webserver-registered routes before dispatch (plugins keep zero auth code).webServer.register()(e.g.requireSession: trueor an auth-wrapping helper) so existing unauthenticated registrations keep working while new ones can require the browser session.webServer.register()extension point so plugin authors know the token gate does not protect them.Happy to send a PR for any of these directions if you point us at the intended one.
All reactions