Files
captoys/diigo-cache/doc/open-issues.md
T
dckcandClaude Opus 5.5 857816166e feat(diigo-cache): production deployment with tailscale, systemd, and nix
diigo binds the session cookie to the IP it was issued to, so a
Cloudflare deployment can't use a cookie minted in the browser. Run
diigo-cache and webapp in one workerd on bldbox instead.

The flake bundles each worker with wrangler's dry run, so the modules
match what `wrangler deploy` ships, and generates the workerd config
from the bundles. workerd comes from nixpkgs' wrangler, the only
packaged one. A smoke check serves the home page and mints a webapp
instance, which covers the WEBAPP binding and Durable Object storage.

The service is a system unit with DynamicUser, so the webapp state
holding the cookie isn't readable by processes running as the user.
It listens on loopback behind tailscale serve: HTTPS, which
PasswordCredential needs, at the tailnet name only.

Operator docs in doc/; unsettled points recorded as IBIS issues.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 23:12:47 -05:00

5.0 KiB

Open issues

In IBIS notation: ? issue, ?! resolved, ?~ open with a fallback; : position, :+ accepted, :- rejected, :~+ fallback; + pro, - con; ! to-do; . comment. Append; don't renumber.

?! 1. How does diigo see the cookie come from the IP it was issued to?
  . observed: minted from the browser, the cookie failed from Cloudflare
  . unverified that IP is the only binding; the mint sends user-agent
    "Mozilla/5.0", not the browser's, and that works in dev
  : 1a. log in to diigo from a browser that shares bldbox's public IP
    (same LAN, same NAT)
    + no setup if that's where the browser already is
    - breaks when the browser roams (phone, laptop away from home)
    ! compare: curl https://ifconfig.me on bldbox and in the browser
  : 1b. advertise bldbox as a tailnet exit node; route the browser through
    it while logging in to diigo and copying the cookie
    + bldbox's IP by construction, from anywhere on the tailnet
    - bldbox isn't an exit node (ExitNodeOption false, 2026-10-14);
      needs `tailscale set --advertise-exit-node` and admin approval
  :+ 1c. run the browser on bldbox
    + worked 2026-10-14: a cookie copied from Brave's devtools on bldbox
      minted, wired public, and filled 168 pages
  :- 1d. deploy to Cloudflare
    - its egress IPs aren't the browser's (the failure that prompted this)

?~ 2. How is diigo-cache reachable only from the tailnet?

?~ 2. How is diigo-cache reachable only from the tailnet?
  :~+ 2a. workerd on 127.0.0.1:8790; tailscale serve proxies
    https://bldbox.tail09e44.ts.net/ to it
    + HTTPS with a real cert: PasswordCredential needs a secure context
    + tailscaled owns the tailnet address; no start-order dependency
    - needs HTTPS certificates on in the tailnet (off as of 2026-10-14)
      ! enable in the admin console (install.md)
    - every local user and process on bldbox reaches 127.0.0.1:8790 (see 3)
      + the cache id is still needed for anything private
  : 2b. listen on 100.89.146.23 directly (ListenStream, FreeBind=yes)
    - plain HTTP: the password-manager button fails
  : 2c. tailscale serve to a unix socket only it can open
    + no loopback port
    - unverified that tailscale 1.90.9 serve takes a unix socket target
  ? 2d. Which tailnet devices may reach it?
    . today: every device on the tailnet (m5x, penguin, pixel-7, tiny-jwc)
    : 2d-i. restrict to some devices with a tailnet ACL grant on bldbox:443

?~ 3. What account does the service run as?

?~ 3. What account does the service run as?
  :~+ 3a. a system unit with DynamicUser=yes
    + the cookie's state is 0700 to a uid nothing else runs as; agents
      and bots running as connolly can't read it
    + full sandboxing (systemd-analyze security: 2.2 OK)
    - install and upgrade need sudo
  : 3b. a user unit under connolly, with lingering
    + no sudo for upgrade; a ~/.local profile
    - the cookie sits in connolly's files, readable by every process
      connolly runs, Discord and opencode bots included
    - Ubuntu's AppArmor userns restriction weakens user-manager sandboxing
    - tailscale serve needs root (or `tailscale set --operator`) anyway

? 4. Does /api need a rate limit on the tailnet?

? 4. Does /api need a rate limit on the tailnet?
  . CONTRIBUTING asks for one "before exposing a deployment"
  :~+ 4a. not while only tailnet devices reach it (see 2)
  : 4b. a rate limit in front of workerd before any funnel (see 5)

? 5. How does the weekly roundup read the public page?

? 5. How does the weekly roundup read the public page?
  . the madmode blog build needs /public/<username>; where does it run?
  : 5a. build on a tailnet device
  : 5b. join CI to the tailnet (Tailscale's GitHub Action)
  : 5c. tailscale funnel just /public/ to the internet
    + public pages are public by design
    - exposes a guessable URL; needs 4b

? 6. How is state backed up?

? 6. How is state backed up?
  :~+ 6a. by hand, service stopped (operate.md)
  : 6b. a systemd timer
    - backups hold the cookie: where do they go, encrypted how?
  : 6c. none: the cache is a cache
    - the ids people saved point at objects that would be gone
? 7. How does a cache get a fresh cookie?
  . a wired cache refuses a different webapp id
  :~+ 7a. mint a fresh webapp instance and wire a new cache
    - a new cache id to save
    + wiring public re-registers the username, so the public URL stays
  : 7b. let webapp replace the cookie in an existing instance
    + cache ids stay put

? 8. Should wrangler dev state move to bldbox?

? 8. Should `wrangler dev` state move to bldbox?
  . Durable Object unique keys follow miniflare's `<script>-<class>`,
    so the per-object files may carry over; untested
  :~+ 8a. start fresh on bldbox
    + dev cookies were minted for wherever dev ran (see 1)
  : 8b. copy .wrangler/state/v3/do/<script>-<class>/ into the state dirs