Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
docs([issue-4901]): update auth gate references
Adam Eivyb79418fe90d3
diff --git a/AGENTS.md b/AGENTS.mdindex 800ad9fae6..42a77052fb 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -27,7 +27,7 @@ npm run test:db # DB-backed suites → portos_test ONLY (see Se**Authentication and HTTPS exist, but are OPT-IN and OFF by default.** Do not assume they are absent:-- **Auth** — an optional instance password (`server/services/auth.js`, enforced by `server/lib/authGate.js`) gates all of `/api/*` and `/data/*` when set, with a small always-public set (`/api/auth/status`, `/api/system/health`). Peers reach a password-gated instance via a per-peer Basic credential on the peer record, attached to every outbound hop by `peerFetch` (`server/lib/peerHttpClient.js`).+- **Auth** — an optional instance password (`server/services/auth.js`, enforced by `server/services/authGate.js`) gates all of `/api/*` and `/data/*` when set, with a small always-public set (`/api/auth/status`, `/api/system/health`). Peers reach a password-gated instance via a per-peer Basic credential on the peer record, attached to every outbound hop by `peerFetch` (`server/lib/peerHttpClient.js`).- **HTTPS** — provisioned by `npm run setup:cert`; `:5555` flips to TLS with a loopback-only HTTP mirror on `:5553`. Peer hops set `rejectUnauthorized: false` ("Tailnet is the trust boundary") — between two tailnet nodes WireGuard already supplies mutual auth, but a non-tailnet peer (plain LAN IP / non-`.ts.net` host, see `peerRequiresTailscale()`) gets no server authentication.Because both are off by default, **never treat "the password is set" as an available guarantee** when designing a feature — gate on it explicitly, or design for the default posture. **PII must not ride the federation layer at all** — see ADR [privacy records machine-local](docs/decisions/2026-08-08-privacy-records-machine-local.md). That rule governs *records* and *status/capability payloads*; its one scoped carve-out is a submitted job body carrying the conditioning an allowlisted peer is being asked to render — the prompt (ADR [federated visual prompts](docs/decisions/2026-08-20-federated-visual-prompts.md)), and, under the same gate, lyrics and conditioning images (ADR [conditioning crosses to an allowlisted peer](docs/decisions/2026-08-22-federated-media-input-assets.md), which also records what stays refused: model weights and multi-step chain state).diff --git a/docs/API.md b/docs/API.mdindex 2df8fa4787..bd4c30acd3 100644--- a/docs/API.md+++ b/docs/API.md@@ -21,7 +21,7 @@ PortOS is designed for personal/developer use on trusted networks. It implements- **Network isolation**: By default, access should be restricted to trusted networks (e.g., Tailscale VPN, localhost)- **Command allowlist**: Shell command execution is restricted to an approved allowlist (see `server/lib/commandSecurity.js`)- **Input validation**: All API inputs are validated using Zod schemas-- **Opt-in authentication**: Off by default (trusting private network/Tailscale), PortOS supports opt-in instance password authentication (enforced by `server/lib/authGate.js`) gating `/api/*`, `/data/*`, and `/sdapi/*` via session cookies, Bearer tokens, or HTTP Basic credentials+- **Opt-in authentication**: Off by default (trusting private network/Tailscale), PortOS supports opt-in instance password authentication (enforced by `server/services/authGate.js`) gating `/api/*`, `/data/*`, and `/sdapi/*` via session cookies, Bearer tokens, or HTTP Basic credentials**Important**: Do not expose PortOS APIs directly to untrusted networks. For production deployments, consider:- Binding to `127.0.0.1` instead of `0.0.0.0`diff --git a/docs/COMPANION_APP_API.md b/docs/COMPANION_APP_API.mdindex 0c90f20335..64065569d4 100644--- a/docs/COMPANION_APP_API.md+++ b/docs/COMPANION_APP_API.md@@ -29,7 +29,7 @@ and must handle both the auth-on/auth-off and HTTP/HTTPS cases per instance.## 1. Discovery & identity (pre-auth)`GET /api/system/health` — **public**, bypasses the auth gate even when the-password is on (`PUBLIC_API_PATHS` in `server/lib/authGate.js`), and is the same+password is on (`PUBLIC_API_PATHS` in `server/services/authGate.js`), and is the sameendpoint Tailscale reachability checks hit. Use it to confirm a tailnet host is aPortOS instance and to label it on a connection screen **before** the app holdsany credential.@@ -66,7 +66,7 @@ route is exposed pre-auth.## 2. AuthenticationPortOS auth is a single optional password (`server/services/auth.js`,-`server/lib/authGate.js`). The app authenticates as a **full session via HTTP+`server/services/authGate.js`). The app authenticates as a **full session via HTTPBasic**, reusing the exact path peer-to-peer federation uses — nothing new tobuild server-side.diff --git a/docs/decisions/2026-08-08-privacy-records-machine-local.md b/docs/decisions/2026-08-08-privacy-records-machine-local.mdindex 8e370aa2f0..5303dde41f 100644--- a/docs/decisions/2026-08-08-privacy-records-machine-local.md+++ b/docs/decisions/2026-08-08-privacy-records-machine-local.md@@ -95,7 +95,7 @@ carve-out, submitted image/video job bodies, is decided in ADR### Why not "federate, but gate it on HTTPS + the instance password"This was seriously considered, and the machinery for it already exists: the-optional instance password (`server/services/auth.js` + `server/lib/authGate.js`)+optional instance password (`server/services/auth.js` + `server/services/authGate.js`)gates all of `/api/*` including `/api/peer-sync/*`; per-peer Basic credentialsare stored on the peer record and attached to every outbound hop by`peerFetch` (`server/lib/peerHttpClient.js`); and `GET /api/auth/status` isdiff --git a/lib/portosAuthCore.js b/lib/portosAuthCore.jsindex 821a140ec6..f22aed1503 100644--- a/lib/portosAuthCore.js+++ b/lib/portosAuthCore.js@@ -1,6 +1,6 @@/*** portosAuthCore — zero-dependency primitives shared by the main PortOS server- * (`server/services/auth.js`, `server/lib/authGate.js`) and by sidecar+ * (`server/services/auth.js`, `server/services/authGate.js`) and by sidecar* processes that must honour the same password gate (`autofixer/ui.js` via* `lib/sidecarAuthGate.js`).*