fix(PROJ-55): Tenant-Isolation für Rolle "auditor" + Audit-Log korrigieren
Kritischer Sicherheitsbug: Auditoren mit zugewiesenem Tenant sahen Mails und Audit-Log-Einträge anderer Tenants (DSGVO-relevant). auditor wird jetzt analog zu domain_auditor pro Tenant gescoped, sofern tenant_id gesetzt ist (Abwärtskompatibilität: ohne tenant_id bleibt der bisherige globale Zugriff erhalten). Betrifft Mail-Suche, Mail-Detailzugriff, Export, eDiscovery, Threads, OCR sowie das Audit-Log (DB + tamper-evidentes Flat-File), inkl. Befüllung von tenant_id an allen Audit-Log-Schreibstellen.
This commit is contained in:
@@ -56,12 +56,23 @@ func (s *Server) handleAuditLog(w http.ResponseWriter, r *http.Request) {
|
||||
pageSize = 50
|
||||
}
|
||||
|
||||
entries, total, err := s.audlog.Query(audit.QueryFilter{
|
||||
// PROJ-55: tenant isolation for the audit log. Any role with a tenant_id
|
||||
// (domain_admin, domain_auditor, and a tenant-scoped auditor) sees only the
|
||||
// audit entries of its own tenant. superadmin has no tenant_id and stays
|
||||
// unfiltered (sees all tenants). A legacy global auditor (no tenant_id) is
|
||||
// likewise unfiltered — its access scope is unchanged.
|
||||
sess := sessionFromCtx(r.Context())
|
||||
filter := audit.QueryFilter{
|
||||
Username: username,
|
||||
EventType: eventType,
|
||||
PageSize: pageSize,
|
||||
Page: page,
|
||||
})
|
||||
}
|
||||
if sess.TenantID != nil {
|
||||
filter.TenantID = sess.TenantID
|
||||
}
|
||||
|
||||
entries, total, err := s.audlog.Query(filter)
|
||||
if err != nil {
|
||||
writeError(w, http.StatusInternalServerError, "audit query failed")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user