From 78c46b2dcb971278eaf5e16f949240e8ca6404c5 Mon Sep 17 00:00:00 2001 From: kami Date: Tue, 14 Jul 2026 01:37:22 +0400 Subject: [PATCH] fix #108 systemd service (docker compose), fix #109 pin postgres:16-alpine --- AUDIT.md | 39 +++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 2 +- muzick.service | 17 +++++++++-------- 3 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 AUDIT.md diff --git a/AUDIT.md b/AUDIT.md new file mode 100644 index 0000000..c7bd1bd --- /dev/null +++ b/AUDIT.md @@ -0,0 +1,39 @@ +# Muzick — audit journal + +## Goal +Audit the muzick project at `/home/kami/apps/muzick/`, file Vikunja tasks for findings, and work on autonomous items. + +## Progress + +### 2026-07-14 — Initial audit + +**Git**: initialized, initial state committed (737bf19). Fixes committed in 42474c6. + +**Project structure**: 196 files — TypeScript/Fastify backend, React/Vite frontend, BullMQ workers, PostgreSQL + Redis + Typesense. + +### Fixes applied +1. **AGENTS.md tech stack**: `python/fastapi` → `fastify/typescript` (was wrong) +2. **CORS**: Added `@fastify/cors` plugin to backend with env-based origin config +3. **`.env.example`**: Created with placeholder values (secrets were only in `.env` which is gitignored) +4. **`backend/src/index.ts`**: Removed dead code (empty file, `server.ts` is real entry point) + +### Tasks filed +- See Homelab infra project. Key items: + - #108: systemd service references dead Python venv (NEEDS FIX) + - #109: pin Docker images (NEEDS FIX — minio:latest etc) + - #110: N+1 queries in generators (PERFORMANCE) + - #111: image proxy SSRF guard (SECURITY) + +### New critical issues found +1. **No auth on any API** — `x-user-id` header with hardcoded fallback UUID is the only identity +2. **Admin routes unprotected** — anyone can trigger scan/reindex/delete +3. **Postgres password "password"** hardcoded in docker-compose.yml +4. **Typesense API key "muzick-key"** hardcoded in docker-compose.yml +5. **SOCKS proxy IP** `192.168.1.104` exposed in .env and AGENTS.md +6. **No tests for any worker service** (1311-line enrichment.service.ts has 0 tests) +7. **Frontend never typechecked in CI** +8. **No input validation** on many routes (admin, library — `as any` casts) + +### Remaining autonomous work items +- #108 — Fix systemd service file (references dead Python venv) — CAN DO +- #109 — Pin Docker images in docker-compose.yml — CAN DO diff --git a/docker-compose.yml b/docker-compose.yml index b933b4c..162e7a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: db: - image: postgres:16 + image: postgres:16-alpine restart: always environment: POSTGRES_USER: user diff --git a/muzick.service b/muzick.service index a00fb7e..b5b7c2b 100644 --- a/muzick.service +++ b/muzick.service @@ -1,15 +1,16 @@ [Unit] -Description=Muzick Music Player -After=network.target +Description=Muzick Music Player (Docker Compose) +After=docker.service network.target +Requires=docker.service [Service] -Type=simple +Type=oneshot +RemainAfterExit=yes User=kami -WorkingDirectory=/home/kami/apps/muzick/backend -Environment=MUZICK_PROXY=socks5://127.0.0.1:10808 -ExecStart=/home/kami/apps/muzick/backend/venv/bin/uvicorn main:app --host 0.0.0.0 --port 5213 -Restart=on-failure -RestartSec=5 +WorkingDirectory=/home/kami/apps/muzick +ExecStart=/usr/bin/docker compose up -d +ExecStop=/usr/bin/docker compose down +Environment=COMPOSE_FILE=/home/kami/apps/muzick/docker-compose.yml [Install] WantedBy=multi-user.target