Deploy the factory floor on matou-workstation at dev-factory.matou.nz, safely #169

Open
opened 2026-09-24 00:51:54 +00:00 by cherese · 6 comments
Owner

Get the factory floor (fleet-tui/floor, pushed in 27fff81) deployed on matou-workstation at https://dev-factory.matou.nz.

It must comply with any safety requirements so it does not leak or expose important information.

Context for triage (facts, not decisions):

  • The floor is read-only, binds to 127.0.0.1 by default and has no authentication of its own.
  • Its snapshots carry host names, repo names, issue numbers/titles, worker activity and raw error strings (e.g. ssh errors).
  • server.js does no WebSocket Origin check.
  • The Forgejo token is read server-side from the operator's config and is not sent to the browser.
  • Existing Matou infra uses Caddy with acme-dns TLS (matou-infrastructure/monitoring/test-infra.caddy) and Zitadel for identity.

Open questions for whoever picks this up: who may view it; where Caddy runs relative to matou-workstation; which login gates it. DNS and host changes are public-facing, so confirm with Reese/Ben before applying them.

Get the factory floor (`fleet-tui/floor`, pushed in 27fff81) deployed on **matou-workstation** at **https://dev-factory.matou.nz**. It must comply with any safety requirements so it does not leak or expose important information. Context for triage (facts, not decisions): - The floor is read-only, binds to 127.0.0.1 by default and has no authentication of its own. - Its snapshots carry host names, repo names, issue numbers/titles, worker activity and raw error strings (e.g. ssh errors). - `server.js` does no WebSocket Origin check. - The Forgejo token is read server-side from the operator's config and is not sent to the browser. - Existing Matou infra uses Caddy with acme-dns TLS (`matou-infrastructure/monitoring/test-infra.caddy`) and Zitadel for identity. Open questions for whoever picks this up: who may view it; where Caddy runs relative to matou-workstation; which login gates it. DNS and host changes are public-facing, so confirm with Reese/Ben before applying them.

This was generated by AI during triage.

Triage: enhancement + ready-for-human

Category: enhancement — this is new public-facing infrastructure (a hosted deployment of the factory floor), not a defect.

State: ready-for-human. I am not ruling this under ADR 0174: it lands squarely on the one-way-door list and needs Reese's/Ben's hands. See ## Why human below.

Codebase check (facts verified against the code)

The floor lives in fleet-tui/floor/ (added/restyled in 27fff81). Every fact the reporter states holds up in the source:

  • Localhost-bound, no auth. server/server.js — const HOST = process.env.FLOOR_HOST || '127.0.0.1'. No authentication layer anywhere in the process.
  • No WebSocket Origin check. The httpServer.on('upgrade', ...) handler validates only the presence of sec-websocket-key and completes the handshake — it never inspects Origin. Any page that can reach the port can open the socket.
  • Token stays server-side. The collector child inherits FORGEJO_TOKEN from the operator env; nothing writes it to the served page. Confirmed.
  • Leaky payload. The broadcast is the collector's raw snapshot verbatim (fleet-tui/floor/server/fixtures/snapshot.json shows the shape): host names, repo names, issue numbers/titles, worker activity, and raw error strings.
  • Design intent is explicitly the opposite of this request. Both server/server.js and run.sh state the floor is "never a hosted artifact reachable outside the operator's own SSH/token trust boundary" (fleet-monitor spec, story 16). This ticket asks to reverse that posture, which is exactly why it needs a human ruling rather than an agent one.

No prior rejection exists (.out-of-scope/ is empty) and there is no existing public deployment — this is genuinely new work.

Why human

Three distinct one-way-door residues, any one of which is disqualifying for an agent ruling:

  1. Security-posture widening. Exposing a no-auth, no-Origin-check, read-only service that leaks host/repo/issue/worker/ssh-error data onto a public domain widens the trust boundary the code was explicitly built to hold. On the ADR 0174 one-way-door list.
  2. Member-facing trust accept. "Who may view it" decides who gets a window into internal factory state — a trust/access decision, not a revertible config toggle.
  3. Ben's/Reese's hands. DNS for dev-factory.matou.nz and host changes on matou-workstation are public-facing; the reporter explicitly requires confirming these with Reese/Ben before applying.

Brief for the human implementer

Open decisions that must be settled first (none are agent-rulable):

  • Audience & login. Decide who may view it, then gate it. Matou already runs Zitadel for identity and Caddy with acme-dns TLS (matou-infrastructure/monitoring/test-infra.caddy) — the natural pattern is Caddy forward-auth → Zitadel in front of the floor, so the floor stays localhost-bound and never authenticates itself.
  • Topology. Decide where Caddy runs relative to matou-workstation (same host vs. a separate reverse-proxy box) and how it reaches the floor's 127.0.0.1:8787 (co-located, or over a private link/tunnel — do not rebind FLOOR_HOST to a public interface).
  • Hardening before go-live regardless of the proxy: add a WebSocket Origin allowlist in server.js (defense in depth even behind auth), and confirm the snapshot's raw error strings / token-absence messages are acceptable to show the chosen audience.
  • DNS & host changes for dev-factory.matou.nz and matou-workstation — confirm with Reese/Ben, then apply.

Once the audience, the login gate, and the topology are decided and confirmed with Reese/Ben, the remaining wiring (Caddy site config, the Origin allowlist) is small and could be split into a follow-up ready-for-agent ticket.

> *This was generated by AI during triage.* ## Triage: `enhancement` + `ready-for-human` **Category:** `enhancement` — this is new public-facing infrastructure (a hosted deployment of the factory floor), not a defect. **State:** `ready-for-human`. I am **not** ruling this under ADR 0174: it lands squarely on the one-way-door list and needs Reese's/Ben's hands. See `## Why human` below. ### Codebase check (facts verified against the code) The floor lives in `fleet-tui/floor/` (added/restyled in `27fff81`). Every fact the reporter states holds up in the source: - **Localhost-bound, no auth.** `server/server.js` — `const HOST = process.env.FLOOR_HOST || '127.0.0.1'`. No authentication layer anywhere in the process. - **No WebSocket Origin check.** The `httpServer.on('upgrade', ...)` handler validates only the presence of `sec-websocket-key` and completes the handshake — it never inspects `Origin`. Any page that can reach the port can open the socket. - **Token stays server-side.** The collector child inherits `FORGEJO_TOKEN` from the operator env; nothing writes it to the served page. Confirmed. - **Leaky payload.** The broadcast is the collector's raw snapshot verbatim (`fleet-tui/floor/server/fixtures/snapshot.json` shows the shape): host names, repo names, issue numbers/titles, worker activity, and raw error strings. - **Design intent is explicitly the opposite of this request.** Both `server/server.js` and `run.sh` state the floor is *"never a hosted artifact reachable outside the operator's own SSH/token trust boundary"* (fleet-monitor spec, story 16). This ticket asks to reverse that posture, which is exactly why it needs a human ruling rather than an agent one. No prior rejection exists (`.out-of-scope/` is empty) and there is no existing public deployment — this is genuinely new work. ### Why human Three distinct one-way-door residues, any one of which is disqualifying for an agent ruling: 1. **Security-posture widening.** Exposing a no-auth, no-Origin-check, read-only service that leaks host/repo/issue/worker/ssh-error data onto a public domain widens the trust boundary the code was explicitly built to hold. On the ADR 0174 one-way-door list. 2. **Member-facing trust accept.** "Who may view it" decides who gets a window into internal factory state — a trust/access decision, not a revertible config toggle. 3. **Ben's/Reese's hands.** DNS for `dev-factory.matou.nz` and host changes on `matou-workstation` are public-facing; the reporter explicitly requires confirming these with Reese/Ben before applying. ### Brief for the human implementer Open decisions that must be settled first (none are agent-rulable): - **Audience & login.** Decide who may view it, then gate it. Matou already runs Zitadel for identity and Caddy with acme-dns TLS (`matou-infrastructure/monitoring/test-infra.caddy`) — the natural pattern is Caddy forward-auth → Zitadel in front of the floor, so the floor stays localhost-bound and never authenticates itself. - **Topology.** Decide where Caddy runs relative to `matou-workstation` (same host vs. a separate reverse-proxy box) and how it reaches the floor's `127.0.0.1:8787` (co-located, or over a private link/tunnel — do **not** rebind `FLOOR_HOST` to a public interface). - **Hardening before go-live regardless of the proxy:** add a WebSocket `Origin` allowlist in `server.js` (defense in depth even behind auth), and confirm the snapshot's raw error strings / token-absence messages are acceptable to show the chosen audience. - **DNS & host changes** for `dev-factory.matou.nz` and `matou-workstation` — confirm with Reese/Ben, then apply. Once the audience, the login gate, and the topology are decided and confirmed with Reese/Ben, the remaining wiring (Caddy site config, the Origin allowlist) is small and could be split into a follow-up `ready-for-agent` ticket.
Author
Owner

The audience should be public, no login required. Add the origin safeguard and hardening needed. Caddy is running on the droplet (100.98.216.186 netbird ip) amnd there is a dns wildcard on it as well, for *.matou.nz.

The audience should be public, no login required. Add the origin safeguard and hardening needed. Caddy is running on the droplet (100.98.216.186 netbird ip) amnd there is a dns wildcard on it as well, for *.matou.nz.

swarm-claim host=bens-mac-04 run=14213
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=14213 (automated multi-host claim — lowest live claim id works this ticket)

Hardening + deploy runbook landed; physical apply handed back

The agent-doable slice of #169 is on main in 76dac17. Following Reese's ruling in this thread (public, no login; add the origin safeguard and hardening; Caddy on the droplet at netbird 100.98.216.186 with the *.matou.nz wildcard):

Hardening (code, tested, landed):

  • fleet-tui/floor/server/protocol.js — pure parseAllowedOrigins + originAllowed; server.js refuses a disallowed WebSocket upgrade with 403 before the handshake (defense in depth vs cross-site WS hijack / embedding). Configured via FLOOR_ALLOWED_ORIGINS. Fails closed: unset → localhost browser origins only, so a public deploy that forgets the var breaks visibly rather than silently accepting every origin. The Forgejo token stays server-side (unchanged); the floor must bind to the netbird interface, never a public one.
  • Tests: fleet-tui/floor/server/protocol.test.js +3 (node --test, 9 total); full offline suite green.

Operator runbook (landed): fleet-tui/floor/deploy/README.md + floor.service.example + caddy.site.example — topology, safety posture, and the apply steps.

Why human

The physical deploy cannot be done or verified from an agent sandbox (no host access) and is public-facing — the ticket itself says to confirm host/DNS changes with Reese/Ben. Remaining, for an operator:

  1. matou-workstation — install/enable factory-floor.service (bind FLOOR_HOST to the host's netbird IP, FLOOR_ALLOWED_ORIGINS=https://dev-factory.matou.nz).
  2. droplet — add the dev-factory.matou.nz Caddy site block (reverse_proxy <netbird-ip>:8787) and reload; the *.matou.nz wildcard already covers DNS + TLS.
  3. verify the live site loads and the feed connects.

Re-arm ready-for-agent only if further code changes are wanted; otherwise the deploy is an operator action.

## Hardening + deploy runbook landed; physical apply handed back The agent-doable slice of #169 is on `main` in `76dac17`. Following Reese's ruling in this thread (**public, no login; add the origin safeguard and hardening; Caddy on the droplet at netbird `100.98.216.186` with the `*.matou.nz` wildcard**): **Hardening (code, tested, landed):** - `fleet-tui/floor/server/protocol.js` — pure `parseAllowedOrigins` + `originAllowed`; `server.js` refuses a disallowed WebSocket upgrade with `403` before the handshake (defense in depth vs cross-site WS hijack / embedding). Configured via `FLOOR_ALLOWED_ORIGINS`. **Fails closed:** unset → localhost browser origins only, so a public deploy that forgets the var breaks visibly rather than silently accepting every origin. The Forgejo token stays server-side (unchanged); the floor must bind to the netbird interface, never a public one. - Tests: `fleet-tui/floor/server/protocol.test.js` +3 (`node --test`, 9 total); full offline suite green. **Operator runbook (landed):** `fleet-tui/floor/deploy/README.md` + `floor.service.example` + `caddy.site.example` — topology, safety posture, and the apply steps. ## Why human The physical deploy cannot be done or verified from an agent sandbox (no host access) and is public-facing — the ticket itself says to confirm host/DNS changes with Reese/Ben. Remaining, for an operator: 1. **matou-workstation** — install/enable `factory-floor.service` (bind `FLOOR_HOST` to the host's netbird IP, `FLOOR_ALLOWED_ORIGINS=https://dev-factory.matou.nz`). 2. **droplet** — add the `dev-factory.matou.nz` Caddy site block (`reverse_proxy <netbird-ip>:8787`) and reload; the `*.matou.nz` wildcard already covers DNS + TLS. 3. **verify** the live site loads and the feed connects. Re-arm `ready-for-agent` only if further code changes are wanted; otherwise the deploy is an operator action.
Author
Owner

matou-workstation and droplet are the same machine

matou-workstation and droplet are the same machine

Runbook re-cut for the single-host topology; physical apply still handed back

Thanks for the clarification, Reese — matou-workstation and the droplet are the same machine. That collapses the topology the prior slice (76dac17) assumed (Caddy on the droplet reaching the floor over the netbird overlay). Landed on main in 43f0d16:

  • fleet-tui/floor/deploy/README.md — topology diagram, safety posture and apply steps now describe one host: FLOOR_HOST=127.0.0.1, Caddy reverse_proxy 127.0.0.1:8787. Loopback is the tightest possible bind (unreachable off-host), strictly safer than the overlay-interface bind it replaces — no port is exposed on any shared interface.
  • fleet-tui/floor/deploy/floor.service.example — FLOOR_HOST=127.0.0.1.
  • fleet-tui/floor/deploy/caddy.site.example — reverse_proxy 127.0.0.1:8787.

Runbook-only (fleet-tui/** is vendor-excluded); no code change — the server.js 127.0.0.1 default already fits, and the FLOOR_ALLOWED_ORIGINS allowlist + server-side-only token are unchanged. Full offline suite + node --test (9) green.

Why human

The physical apply cannot be done or verified from an agent sandbox (no host access) and is public-facing — the ticket requires confirming host changes with Reese/Ben. Remaining, for an operator on the host:

  1. Install/enable factory-floor.service (FLOOR_HOST=127.0.0.1, FLOOR_ALLOWED_ORIGINS=https://dev-factory.matou.nz); confirm ss -ltnp | grep 8787 shows loopback.
  2. Add the dev-factory.matou.nz Caddy site block (reverse_proxy 127.0.0.1:8787) and reload; the *.matou.nz wildcard already covers DNS + TLS.
  3. Verify the live public site loads and the feed connects.

Re-arm ready-for-agent only if further code changes are wanted; otherwise the deploy is an operator action.

## Runbook re-cut for the single-host topology; physical apply still handed back Thanks for the clarification, Reese — **matou-workstation and the droplet are the same machine**. That collapses the topology the prior slice (`76dac17`) assumed (Caddy on the droplet reaching the floor over the netbird overlay). Landed on `main` in `43f0d16`: - `fleet-tui/floor/deploy/README.md` — topology diagram, safety posture and apply steps now describe **one host**: `FLOOR_HOST=127.0.0.1`, Caddy `reverse_proxy 127.0.0.1:8787`. Loopback is the tightest possible bind (unreachable off-host), **strictly safer** than the overlay-interface bind it replaces — no port is exposed on any shared interface. - `fleet-tui/floor/deploy/floor.service.example` — `FLOOR_HOST=127.0.0.1`. - `fleet-tui/floor/deploy/caddy.site.example` — `reverse_proxy 127.0.0.1:8787`. Runbook-only (`fleet-tui/**` is vendor-excluded); **no code change** — the `server.js` `127.0.0.1` default already fits, and the `FLOOR_ALLOWED_ORIGINS` allowlist + server-side-only token are unchanged. Full offline suite + `node --test` (9) green. ## Why human The physical apply cannot be done or verified from an agent sandbox (no host access) and is public-facing — the ticket requires confirming host changes with Reese/Ben. Remaining, for an operator on the host: 1. Install/enable `factory-floor.service` (`FLOOR_HOST=127.0.0.1`, `FLOOR_ALLOWED_ORIGINS=https://dev-factory.matou.nz`); confirm `ss -ltnp | grep 8787` shows loopback. 2. Add the `dev-factory.matou.nz` Caddy site block (`reverse_proxy 127.0.0.1:8787`) and reload; the `*.matou.nz` wildcard already covers DNS + TLS. 3. Verify the live public site loads and the feed connects. Re-arm `ready-for-agent` only if further code changes are wanted; otherwise the deploy is an operator action.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#169
No description provided.