# Deploy: Vault owner-only guard on Obsidian routes **Date:** 2026-06-18 **Scope:** `hermes-mcp` only — backend change, full rebuild required --- ## Security Issue Any user who (1) creates a free SquareMCP account and (2) connects the Living Brief GPT via OAuth could read and write the owner's Obsidian vault. Root cause: the vault is a single global filesystem path (`OBSIDIAN_VAULT_PATH`) with no per-customer isolation. The `requireCapability('obsidian')` middleware only checked whether the OAuth client had the capability — not whether the authenticated user was the vault owner. ## Fix Added `requireOwner` middleware (`src/index.ts`) applied to all five obsidian routes after `requireCapability`. It allows: - Global API key (`API_KEY`) — always the owner - Customers with `role = 'admin'` — the first registered user Regular customers (free/starter/growth plans with `role = 'user'`) get: ```json { "error": "vault_access_restricted", "message": "Obsidian vault access is restricted to the account owner." } ``` ## Files Changed | File | Change | |------|--------| | `src/index.ts` | Added `requireOwner` middleware function; applied to all 5 obsidian routes after `requireCapability('obsidian')` | --- ## Deploy Commands ```bash git add src/index.ts git commit -m "security: restrict obsidian vault routes to owner only" git push origin main docker build -f Dockerfile -t localhost:32000/hermes-mcp:$(git rev-parse --short HEAD) . docker push localhost:32000/hermes-mcp:$(git rev-parse --short HEAD) # Update image SHA in hermes-k8s.yaml, then: kubectl apply -f hermes-k8s.yaml -n fetcherpay kubectl rollout status deployment/hermes-mcp -n fetcherpay ``` --- ## Verification 1. Log in as a non-admin SquareMCP account and connect Living Brief GPT via OAuth 2. Call `GET /api/obsidian/search?query=test` — should return `403 vault_access_restricted` 3. Log in as admin (owner) account — same call should work ## Verification result