fix(security): Fail-closed Tenant-Filter in v1-Suche + SMTP-Out-Key-Kette gehärtet

Security-Audit-Nachtrag (siehe PROJ-64):

- internal/api/v1_handlers.go: handleV1SearchMails fehlte der fail-closed
  Tenant-Post-Filter-Fallback für den Fall idxMgr==nil (gleiches Muster wie
  bereits in search_handlers.go). Aktuell nicht ausnutzbar, da idxMgr in
  main.go immer gesetzt wird, aber strukturelle Absicherung gegen künftige
  Regressionen (analog PROJ-55 BUG-1).
- internal/smtpoutconfig/store.go: Verschlüsselungsschlüssel wird jetzt aus
  dem HKDF-abgeleiteten aesKey gebildet statt aus dem rohen cfg.API.Secret,
  konsistent mit internal/ldapconfig und internal/imap/store.go (SEC-08).
  Verifiziert: smtp_out_config auf Produktiv (131) war leer, kein
  Breaking Change für bestehend gespeicherte Zugangsdaten.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sysops
2026-07-03 22:48:55 +02:00
co-authored by Claude Sonnet 5
parent be93614c9f
commit 99e4c1bbe4
2 changed files with 26 additions and 0 deletions
+4
View File
@@ -53,6 +53,10 @@ type Store struct {
}
// New connects to PostgreSQL, creates the table if needed, and returns a Store.
// secret is the HKDF-derived aesKey (see main.go, SEC-08) — not the raw
// cfg.API.Secret — so this store shares the same key-derivation lineage as
// internal/ldapconfig and internal/imap/store.go. The "-smtpout" suffix keeps
// this store's encryption key domain-separated from those.
func New(dsn, secret string) (*Store, error) {
ctx := context.Background()
pool, err := pgxpool.New(ctx, dsn)