"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.EmailService = void 0; /** * Email notification service using nodemailer. * Supports SMTP configuration via environment variables. */ const nodemailer_1 = __importDefault(require("nodemailer")); class EmailService { constructor(config, logger) { this.config = config; this.logger = logger; this.transporter = nodemailer_1.default.createTransport({ host: config.host, port: config.port, secure: config.secure, auth: config.user ? { user: config.user, pass: config.password } : undefined, }); } async send(message) { try { await this.transporter.sendMail({ from: this.config.from, to: Array.isArray(message.to) ? message.to.join(', ') : message.to, subject: message.subject, html: message.html, text: message.text, }); this.logger.info({ to: message.to, subject: message.subject }, 'Email sent'); } catch (err) { this.logger.error({ err, to: message.to }, 'Failed to send email'); throw err; } } async verify() { try { await this.transporter.verify(); return true; } catch { return false; } } /** * Generate a finding notification email. */ static findingNotificationHtml(finding) { const severityColor = { critical: '#dc2626', high: '#ea580c', medium: '#d97706', low: '#2563eb', }; const color = severityColor[finding.severity] ?? '#6b7280'; return `

New Security Finding

ABE has detected a potential security issue.

${finding.severity} ${finding.type}

${finding.description}

${finding.url ? `

URL: ${finding.url}

` : ''}
View Finding Details

You received this email because you have finding notifications enabled in ABE.
Manage notifications

`; } } exports.EmailService = EmailService;