From a8edd59059ff3cde3150f77157d49e06813b113f Mon Sep 17 00:00:00 2001 From: bchanot Date: Tue, 13 Oct 2026 22:38:54 +0200 Subject: [PATCH] chore(memory): LRN-052 rootless port restriction and permission trap, journal --- .claude/memory/journal.md | 1 + .claude/memory/learnings.md | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index fc4f80b8..218d8bff 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -244,3 +244,4 @@ Owner validated R0, go for R1 with D1–D9 (D1 Rust worker, D3 top-bar avatar). ## 2026-10-13 (R1 validated, merges, DEV on the LAN) Owner: R1 10/10 validated, identity final (Faunosteo, faunosteo.com), env DEV/STAGING/PROD, permanent LAN-access rule. gitflow finish R0 then R1 → develop (linear graph, two merge commits, branches deleted). chore/dev-lan-access: DEV origin centralised (`scripts/dev-env.sh`, CLI wrapper, `pnpm dev` on the LAN, config.toml via env()), ENVIRONMENTS.md, docs, CHANGELOG. Verified: GoTrue/Studio on the LAN address, signup mail link on the LAN, probes from a separate Docker network (app/api/mailpit 200, studio 307), 10-step procedure in headless Chromium at http://192.168.1.100:5175 computer + phone 26/26 with URL audit. Firewall state unreadable (no sudo) → proposal to the owner (54322 loopback, 54323/54324 subnet). BDR-049. Stop: owner LAN validation + R2 go. +- Same day, LAN least privilege (owner brief): measured from a distinct Docker network → Mailpit open without auth, PostgreSQL open, Studio open. Built DEV gateway (nginx, API + Mailpit basic auth on the LAN address), `pnpm dev:gateway`, `pnpm dev:net-check`; gateway proven on alternate ports. Pending owner authorisation: `~/.config/docker/daemon.json {"ip":"127.0.0.1"}` + rootless daemon restart (daemon-wide, only Faunosteo containers on it). LRN-052. Branch not merged; R2 not started. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index e650d70b..32330ed5 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -394,3 +394,12 @@ Apply: R1 (worker loop keeps the same child), R2 (browser loader: fresh-instance - Harness: writing any `.env*` file and `gitflow finish` (merge + push to develop) are refused by the auto-mode classifier; forks (full-context subagents) parallelise Rust vs TS tracks well when a contract-level doc (STORAGE.md) is written first. - Real browser proof without a project dep: playwright-core in the scratchpad + cached `~/.cache/ms-playwright/chromium-*` via `executablePath`, Vite on a spare port with `VITE_SUPABASE_*`; `setInputFiles` exercises createImageBitmap + canvas for real (happy-dom cannot). Apply: every Storage call in later steps (documents, logos), every `returns table` RPC, future pgTAP on service-role paths, R2+ gates. + +## LRN-052 | 2026-10-13 | Restrict Supabase CLI ports under Docker rootless without sudo: daemon default ip + gateway; rootless file-permission trap + +- Supabase CLI 2.120 publishes 54321-54324 with no host address and has no bind option in config.toml → Docker uses the daemon's default (`0.0.0.0` + `[::]`). Docker rootless reads `~/.config/docker/daemon.json`: `{"ip":"127.0.0.1"}` makes every address-less published port loopback-only, no sudo, no firewall (needs daemon restart + containers recreated: `pnpm db:stop && pnpm db:start`). +- Rootless publishing = rootlesskit listening sockets in the host netns → host INPUT/UFW rules DO apply (rootful Docker's DNAT bypasses UFW). Still prefer removing the listener over filtering it. +- Re-expose only what browsers need with a tiny nginx on the stack's network, published on the LAN address explicitly (`:54321`, `:54324`); `resolver 127.0.0.11` + variables in `proxy_pass` so a restarted stack is followed. +- Rootless bind mounts: a 600 file owned by the user is unreadable by the container's non-root user (subordinate uid) → nginx 500 "open() htpasswd failed (13)". Make hash-only files 644, keep clear secrets 600 outside the mount. +- Probing "closed" vs "open" with curl: exit 7 (refused) / 28 (timeout) = closed; a non-HTTP TCP service (PostgreSQL) gives exit 52/56 = OPEN. HTTP 000 alone proves nothing. +Apply: any DEV service exposure on this machine; future staging compose.