Files
tessera-ctl/apps/api/src/dkv/dto/dkv-config.dto.ts
T
schalli 01ff137f43
Tessera CI/CD / Lint & Type Check (push) Waiting to run
Tessera CI/CD / Tests (push) Blocked by required conditions
Tessera CI/CD / Build & Deploy (push) Blocked by required conditions
fix(07): UAT fixes — SMTP test email, DKV routing, Exchange domain field
- SMTP: add test-to field, send real email via sendMail() instead of verify()
- SMTP: fix no_auth warning shown as error for open-relay servers
- DKV: register dkv-fleet in MODULE_REGISTRY (fixes "Modul nicht gefunden")
- DKV: add dynamic [category]/[moduleSlug]/settings + vehicles sub-routes
- DKV: settings/vehicles links use useParams for consistent URLs
- DKV: add gear icon settings link to module main page
- DKV: rename module to "DKV-Rechnung" in seed + translations
- DKV: add optional domain field for Exchange (WebCredentials 3rd arg)
- DKV: hide IMAP-only fields (Port/Verschlüsselung/Ordner) when Exchange selected
- DKV: hide Exchange-only field (Domain) when IMAP selected
- Prisma: add domain column to DkvModuleConfig

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-28 21:58:26 +02:00

119 lines
2.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import {
IsBoolean,
IsEmail,
IsIn,
IsInt,
IsOptional,
IsString,
Max,
Min,
} from 'class-validator';
/**
* DTO for creating or updating DKV module configuration.
*
* Security:
* - T-07-04: senderFilter validated as email address (injection mitigation)
* - T-07-04: port constrained to 1–65535 (invalid port rejection)
* - T-07-04: protocol and encryption constrained with @IsIn (enum injection mitigation)
* - T-07-05: pollIntervalMin minimum 5 (DoS mitigation — no sub-5-minute polling)
*/
export class DkvConfigDto {
/**
* Inbox protocol — 'imap' for IMAP, 'exchange' for Exchange (EWS).
*/
@IsIn(['imap', 'exchange'])
protocol!: string;
/**
* Mail server hostname or IP address (IMAP: IMAP server, Exchange: EWS endpoint host).
*/
@IsOptional()
@IsString()
host?: string;
/**
* TCP port. Standard values: 993 (IMAP SSL/TLS), 143 (IMAP STARTTLS), 443 (EWS).
*/
@IsOptional()
@IsInt()
@Min(1)
@Max(65535)
port?: number;
/**
* TLS mode: 'none' = plain TCP, 'starttls' = STARTTLS upgrade, 'ssl-tls' = implicit TLS.
*/
@IsIn(['none', 'starttls', 'ssl-tls'])
encryption!: string;
/**
* IMAP folder to monitor (e.g. "INBOX", "DKV"). Exchange always uses Inbox.
*/
@IsOptional()
@IsString()
folder?: string;
/**
* Sender email address to filter by. Only emails from this sender are processed.
* Validated as email address to prevent header injection (T-07-04 / Research V5).
*/
@IsOptional()
@IsEmail()
senderFilter?: string;
/**
* Email address to which the generated Excel export is sent.
* Validated as email address (T-07-04).
*/
@IsOptional()
@IsEmail()
exportRecipient?: string;
/**
* Polling interval in minutes. Minimum 5 minutes to prevent DoS via excessive polling
* (T-07-05, UI-SPEC minimum = 5). Maximum 1440 (24 h) — values above 59 use the cron
* hours field (must be a factor of 24 for predictable hourly+ behaviour).
*/
@IsOptional()
@IsInt()
@Min(5)
@Max(1440)
pollIntervalMin?: number;
/**
* Whether the automatic polling cron job is active.
*/
@IsOptional()
@IsBoolean()
isActive?: boolean;
/**
* Format string for the Fahrzeug column in the Excel export.
* Placeholders: {Marke}, {Modell}, {Kennzeichen}, {Fahrer}.
* Default: "{Marke}/{Modell}/{Kennzeichen}".
*/
@IsOptional()
@IsString()
vehicleFormatString?: string;
/**
* Inbox username (stored encrypted; cleared after save).
*/
@IsOptional()
@IsString()
domain?: string;
@IsOptional()
@IsString()
username?: string;
/**
* Inbox password (stored encrypted; cleared after save).
* T-07-03: never returned to the frontend in responses.
*/
@IsOptional()
@IsString()
password?: string;
}