Commit Graph
10 Commits
Author SHA1 Message Date
Leon Tonhäuser 0931ffc777 feat: add admin albums tab with access overview and bulk grants
New /admin/alben page: all Immich albums with per-album editorial grant
chips (link + one-click revoke) and a bulk-grant form (multiple albums x
multiple editorials, select-all, search). bulkGrantAlbums validates album
existence once via listAlbums, skips already-active pairs, and commits
each pair in its own transaction with full audit attribution.
2026-09-01 17:17:02 +02:00
Leon Tonhäuser 0b65fbba16 fix: rebuild migration history as baseline so migrate works on prod
Squash the 13 historical migrations into one generated baseline whose
journal entry reuses the original 0000 timestamp: the migrator skips it
on every existing database (prod journal stuck at 0006) and applies it
only on fresh ones. Parity with the old chain verified via pg_dump diff
plus fresh/existing/prod-simulated drizzle-kit migrate runs. Historical
files move to drizzle-history/pre-squash-2026-08/ for integration tests
that exercise legacy migration behavior.

Also repair db tests that already failed before this change:
- raw SQL targeted users, but the table has always been "user"
- membership recheck mocked legacy getAsset.albums instead of searchPhotos
- audit rollback assertion walks drizzle's wrapped error cause chain
- keyset index probe pinned to NULLS LAST ordering, removing a planner
  cost tie-break that flipped with index creation order
2026-08-25 11:56:52 +02:00
Leon Tonhäuser 2949149170 docs: record prod migration-journal debt and two_factor field contract 2026-08-25 03:32:52 +02:00
Leon Tonhäuser 0d939593c8 feat: enforce admin 2FA, step-up auth, stronger password policy
Implements OWASP audit recommendations P1-P3:

P1 - Two-factor authentication (TOTP) mandatory for admins:
- better-auth twoFactor plugin; new two_factor table + user flag
  (migration 0010, MUST run before deploying the app)
- requireAdmin throws TWO_FACTOR_REQUIRED without a finished setup;
  pages redirect to the new /zwei-faktor wizard which uses a weak
  guard (allowWithoutTwoFactor) so admins can never lock themselves
  out. Wizard lives outside /admin to avoid layout redirect loops.
- login flow handles twoFactorRedirect and asks for the TOTP code;
  backup codes are shown once during enablement

P2 - Step-up for destructive operations (ASVS 2.5.4):
- hardDeleteEditorialAction and resetUsageDataAction reject sessions
  older than 15 minutes (SESSION_STALE) with actionable German
  messages instead of throwing opaque digests

P3 - Password policy (NIST 800-63B):
- minimum length raised from 8 to 12 plus common-password denylist,
  enforced for registration AND reset/change via a before-hook
2026-08-25 02:30:58 +02:00
Leon Tonhäuser dd60fd6ee6 feat: auto-assign new Immich albums via keyword rules
Auto-assignment rules were only applied when an admin clicked
"Regeln jetzt anwenden". New albums created in Immich therefore
never reached editorials automatically.

- applyAllRules() syncs every active editorial's keywords against the
  full album list in one pass and grants matches as system actor
- in-process scheduler (src/instrumentation.ts) runs the sync every
  AUTO_RULE_SYNC_INTERVAL_SECONDS (default 120s)
- POST /api/cron/album-sync allows external triggers via CRON_SECRET
- overlapping sync runs coalesce to avoid duplicate grants/emails
2026-08-25 01:05:04 +02:00
Leon TonhäuserandClaude 21d41c7017 docs: record archiver v8 export-is-a-class gotcha in AI_MEMORY
Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-11 14:48:14 +02:00
Leon TonhäuserandClaude ca5f79e193 docs: correct AI_MEMORY album-membership guidance for current Immich
getAlbum no longer returns assets on current Immich (AlbumService.get uses
{ withAssets: false }), so the old "getAlbum + iterate album.assets" best
practice is wrong and caused the download-404 bug. Document the
search/metadata id+albumIds membership check now in use.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-11 14:26:16 +02:00
Leon Tonhäuser b81cd7c3e2 docs: update AI Memory with watermark, responsive emails and image styling quirks 2026-08-11 13:14:45 +02:00
Leon Tonhäuser ed957e6559 docs: update AI memory with recent fixes and architectural knowledge 2026-08-11 12:52:23 +02:00
Leon Tonhäuser 4667615ed0 feat: implement hard delete, email notifications, watermark, and fix bulk download 2026-08-11 12:28:39 +02:00