Skip to content

ht-llama-webui Tauri shell: bind dual-stack on port 5173 to prevent IPv6 squatter hijack #50

@marksverdhei

Description

@marksverdhei

Repro

  1. Have any other process bind IPv6 [::1]:5173 (common: a stray vite dev from another project).
  2. Launch the Tauri shell — ht-llama-webui binds IPv4 127.0.0.1:5173.
  3. webkit2gtk's localhost resolution prefers IPv6, so the webview loads the squatter's bundle instead of ht-llama's.
  4. UI hangs on splash forever (squatter's app has no /index.html under our routes).

Hit on 2026-05-16 by Markus when a vite dev server from ~/marksverdhei/alacritty/demo was running. Diagnosed jointly with the inventory-dev agent (same regex / port collision applied there too).

Root cause

tools/ui/ui.cpp (or wherever the Tauri shell spawns the embedded http server) binds 127.0.0.1 only. Webkit2gtk resolves localhost::1 first and tries IPv6 before IPv4, so any IPv6 squatter on 5173 wins the race.

Fix options

  1. Bind dual-stack: [::]:5173 accepting both IPv4 and IPv6 — webkit2gtk hits us on IPv6 first, no squatter possible because we own the socket.
  2. Pick a private port: something like 47783 — drops the collision surface dramatically. Downside: port conflicts with anything random.
  3. Bind [::1]:5173 explicitly: force IPv6, matching what webview expects. IPv4 callers from the same host stop working though.

Recommended: option 1. Webkit can talk to us via ::1, curl/external test scripts keep working via 127.0.0.1.

Acceptance

  • Running vite dev (or any other IPv6 listener) on port 5173 in another shell does not steal the ht-llama-webui webview's bundle.
  • curl http://[::1]:5173/index.html returns the ht-llama bundle.
  • curl http://127.0.0.1:5173/index.html continues to return the ht-llama bundle (unchanged from today).

Refs

  • Diagnostic transcript: inventory-dev <-> ht-llama agent exchange, 2026-05-16.
  • Adjacent fix in the cloud repo: snoop-kube's ba325a3 (unified-llm Dockerfile) — separate symptom, same Markus-on-2026-05-16 incident chain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions