Skip to content

Listen address: the case where authentication exists but is not in STUdio #45

Description

@lgnap

Follow-up to the exchange on #43, opened separately so that PR stays about the frontend.

You closed the -Dstudio.host question with a criterion I think is the right one:

What would change my mind is authentication, not configurability — if the API is ever safe to expose, studio.host becomes reasonable the same day.

I dropped it from the PR and I am not asking you to reverse that. But I want to put one topology in front of you, because I think it meets your criterion rather than dodging it, and I had not stated it properly before.

The topology

A Raspberry Pi sits where the Lunii is, with the device plugged into it, running STUdio. The reverse proxy is not on the Pi — it is the machine that already fronts the household's other services, and it is where authentication already lives. It forwards to the Pi over the LAN.

The device has to be physically plugged into something, and an always-on Pi next to where the toy lives is a better answer than a laptop that has to be fetched each time.

This is not hypothetical on the architecture side: libusb4java 1.3.0 publishes both linux-aarch64 and linux-arm on Central, so 64-bit and 32-bit Raspberry Pi OS are both covered by the existing dependency. Nothing about the driver needs to change.

Why a proxy does not remove the need here

If the proxy runs on the same machine, it reaches 127.0.0.1:8080 and your fixed binding is untouched — no setting needed, and that is a real answer for a desktop install. I said as much before thinking about the other case.

When the proxy is on a different machine, that stops working: it has to reach the Pi across the network, so STUdio on the Pi has to bind something other than the loopback. There is no arrangement of proxies that avoids it.

So the request is narrower than "let me expose the API": it is "let me bind an address an authenticating proxy can reach". The authentication you want exists in that setup. It is just not inside STUdio — which, for a tool this size, seems like the right place for it not to be.

What I would not want you to accept without noticing

Three things, because I would rather state them than have you find them:

  1. The proxy-to-STUdio hop is unauthenticated and in the clear. Anyone on the LAN who can reach the Pi's port bypasses the proxy completely. This arrangement is only as good as a firewall rule restricting that port to the proxy's address, and that rule lives outside the application where nothing verifies it. That is a genuine weakening compared to the loopback, not a technicality.

  2. This is why the setting should be an address, not a flag. -Dstudio.host=192.168.1.42 binds one interface; a boolean would only ever mean 0.0.0.0. The implementation I dropped took an address for that reason.

  3. It does not solve CSRF, and neither does any proxy. uploadToLibrary calls xhr.send(formData) with no custom header, so the request is multipart/form-data — a CORS-simple content type, no preflight. A page in the user's browser can fire it, and CORS will stop the response being read but not the write from happening. Proxy authentication authenticates the browser, so a session would ride along. That is true on a loopback-only install today; it is not an argument against binding wider, but it is the hole I would fix first if remote use is ever supported. I can open that separately with a reproduction if it is useful.

What I am actually asking

Not for the setting back. For your read on whether "authentication exists, at a proxy, on another host" counts as meeting your condition, or whether your position is specifically that STUdio itself must authenticate before its socket may widen.

Both are defensible and it is your project. If it is the second, say so and I will stop raising it — the answer being written down somewhere is worth more to me than the answer going my way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions