UNPKG

@mikkelscheike/email-provider-links

Version:

TypeScript library for email provider detection with 140 providers (259 domains), concurrent DNS resolution, alias normalization, and HTTPS login URL validation for login and password reset flows

82 lines 2.57 kB
/** * URL Security Validation Module * * Provides validation and allowlisting for email provider URLs to prevent * malicious redirects and supply chain attacks. */ /** * Get allowlisted domains from provider data * Only URLs from these domains will be considered safe. */ export declare function getAllowedDomains(): Set<string>; type ProviderUrlLike = { companyProvider?: string; loginUrl?: string | null; }; export interface URLValidationResult { isValid: boolean; reason?: string; domain?: string; normalizedUrl?: string; } /** * Validates if a URL is safe for email provider redirects * * @param url - The URL to validate * @param allowedDomainsOverride - Optional allowlist to avoid recomputing from disk * @returns Validation result with details */ export declare function validateEmailProviderUrl(url: string, allowedDomainsOverride?: Set<string>): URLValidationResult; /** * Validates all URLs in an email providers array * * @param providers - Array of email providers to validate * @returns Array of validation results */ export declare function validateAllProviderUrls(providers: ProviderUrlLike[]): Array<{ provider: string; url: string; validation: URLValidationResult; }>; /** * Validates all URLs in an email providers array, with optional precomputed allowlist. * This avoids recomputing the allowlist from disk for performance-sensitive codepaths. */ export declare function validateAllProviderUrlsWithAllowlist(providers: ProviderUrlLike[], allowedDomainsOverride?: Set<string>): Array<{ provider: string; url: string; validation: URLValidationResult; }>; /** * Security audit function to check all provider URLs * * @param providers - Array of email providers to audit * @returns Security audit report */ export declare function auditProviderSecurity(providers: ProviderUrlLike[]): { total: number; valid: number; invalid: number; invalidProviders: { provider: string; url: string; validation: URLValidationResult; }[]; report: string; }; /** * Security audit function to check all provider URLs, with optional precomputed allowlist. */ export declare function auditProviderSecurityWithAllowlist(providers: ProviderUrlLike[], allowedDomainsOverride?: Set<string>): { total: number; valid: number; invalid: number; invalidProviders: { provider: string; url: string; validation: URLValidationResult; }[]; report: string; }; export {}; //# sourceMappingURL=url-validator.d.ts.map