multica/server/internal
LinYushen b5674869ed
fix(auth): enforce auth on daemon API routes (#224)
* fix(auth): enforce auth middleware and workspace membership on daemon API routes

Daemon routes were registered without the Auth middleware, meaning the
server accepted unauthenticated requests to register runtimes, claim
tasks, etc. The daemon client already sends a Bearer token — the server
just wasn't validating it.

- Split /api/daemon routes: pairing-session endpoints stay public (used
  before the daemon has a token), all others now require Auth middleware
- Add workspace membership check in DaemonRegister so only workspace
  members can register runtimes
- Update test to include X-User-ID header matching the new auth requirement

Closes MUL-90

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor(daemon): remove dead pairing-session feature

The daemon pairing flow was never completed — the daemon authenticates
via CLI config token, not pairing sessions. Remove all related code:

- Delete daemon_pairing.go handler (4 unused handlers)
- Remove pairing routes from router.go (3 public + 1 protected)
- Delete /pair/local page + test from frontend
- Remove DaemonPairingSession types and API client methods
- Add migration 029 to drop daemon_pairing_session table
- Update LOCAL_DEVELOPMENT.md to reflect actual auth flow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 16:13:58 +08:00
..
auth feat(upload): signed URLs for CLI + eager load attachments on comments 2026-03-31 15:42:10 +08:00
cli feat(daemon): add --profile flag for multi-environment isolation 2026-03-30 20:21:23 +08:00
daemon fix(tests): merge main, renumber migration, fix execenv test assertions 2026-03-31 15:17:09 +08:00
events feat(realtime): WS invalidation + refetch pattern, inbox bugfixes, UI polish 2026-03-29 13:49:40 +08:00
handler fix(auth): enforce auth on daemon API routes (#224) 2026-03-31 16:13:58 +08:00
logger feat(logging): add structured logging across server and SDK 2026-03-26 10:57:11 +08:00
middleware fix(upload): harden upload flow — sanitize filenames, refresh CF cookies, deduplicate handlers 2026-03-31 15:52:40 +08:00
realtime feat(realtime): route personal events to target user only 2026-03-29 17:42:50 +08:00
service feat(server): trigger agents via @mention in comments 2026-03-31 15:30:24 +08:00
storage fix(upload): harden upload flow — sanitize filenames, refresh CF cookies, deduplicate handlers 2026-03-31 15:52:40 +08:00
util feat(server): trigger agents via @mention in comments 2026-03-31 15:30:24 +08:00