Test: Audit-Request-Kontext und Mail-Absender je Mandant

10 Prüfungen: IP/User-Agent null außerhalb eines Requests, Anzeigename und
Reply-To des Mandanten, Plattform-Adresse bleibt, Header-Injection bereinigt,
Rückfall auf Plattform-Defaults für Plattform-Mails.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 12:21:34 +02:00
co-authored by Claude Opus 5
parent b8b8bddefe
commit ee27af7cd4
2 changed files with 76 additions and 1 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ export async function markMailFailed(mailLogId: string, error: string): Promise<
* the platform address (SPF/DKIM alignment); only the display name and Reply-To vary.
* Raw client on purpose: the worker has no tenant context; the MailLog row carries the tenant.
*/
async function tenantSender(mailLogId: string, config: MailConfig): Promise<{ from: string; replyTo?: string }> {
export async function tenantSender(mailLogId: string, config: MailConfig): Promise<{ from: string; replyTo?: string }> {
const log = await prisma.mailLog.findUnique({ where: { id: mailLogId }, select: { tenantId: true } });
if (!log?.tenantId) return { from: mailFrom(config), replyTo: config.replyTo };
const settings = await prisma.tenantSettings.findUnique({