@agenticmail/core 0.9.11 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +11 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -764,6 +764,7 @@ __export(index_exports, {
|
|
|
764
764
|
getSmsProvider: () => getSmsProvider,
|
|
765
765
|
hostSessionStoragePath: () => hostSessionStoragePath,
|
|
766
766
|
isInternalEmail: () => isInternalEmail,
|
|
767
|
+
isLoopbackMailHost: () => isLoopbackMailHost,
|
|
767
768
|
isSessionFresh: () => isSessionFresh,
|
|
768
769
|
isValidPhoneNumber: () => isValidPhoneNumber,
|
|
769
770
|
loadHostSession: () => loadHostSession,
|
|
@@ -780,6 +781,7 @@ __export(index_exports, {
|
|
|
780
781
|
redactSecret: () => redactSecret,
|
|
781
782
|
redactSmsConfig: () => redactSmsConfig,
|
|
782
783
|
resolveConfig: () => resolveConfig,
|
|
784
|
+
resolveTlsRejectUnauthorized: () => resolveTlsRejectUnauthorized,
|
|
783
785
|
safeJoin: () => safeJoin,
|
|
784
786
|
sanitizeEmail: () => sanitizeEmail,
|
|
785
787
|
saveConfig: () => saveConfig,
|
|
@@ -799,6 +801,14 @@ module.exports = __toCommonJS(index_exports);
|
|
|
799
801
|
// src/mail/sender.ts
|
|
800
802
|
var import_nodemailer = __toESM(require("nodemailer"), 1);
|
|
801
803
|
var import_mail_composer = __toESM(require("nodemailer/lib/mail-composer/index.js"), 1);
|
|
804
|
+
function isLoopbackMailHost(host) {
|
|
805
|
+
const h = (host ?? "").trim().toLowerCase().replace(/^\[|\]$/g, "");
|
|
806
|
+
return h === "localhost" || h === "::1" || h.endsWith(".localhost") || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h);
|
|
807
|
+
}
|
|
808
|
+
function resolveTlsRejectUnauthorized(host, explicit) {
|
|
809
|
+
if (explicit !== void 0) return explicit;
|
|
810
|
+
return !isLoopbackMailHost(host);
|
|
811
|
+
}
|
|
802
812
|
var MailSender = class {
|
|
803
813
|
constructor(options) {
|
|
804
814
|
this.options = options;
|
|
@@ -812,7 +822,7 @@ var MailSender = class {
|
|
|
812
822
|
pass: options.password
|
|
813
823
|
},
|
|
814
824
|
tls: {
|
|
815
|
-
rejectUnauthorized: options.tlsRejectUnauthorized
|
|
825
|
+
rejectUnauthorized: resolveTlsRejectUnauthorized(options.host, options.tlsRejectUnauthorized)
|
|
816
826
|
},
|
|
817
827
|
connectionTimeout: 1e4,
|
|
818
828
|
// 10s to establish TCP connection
|
|
@@ -9156,6 +9166,7 @@ function parse(raw) {
|
|
|
9156
9166
|
getSmsProvider,
|
|
9157
9167
|
hostSessionStoragePath,
|
|
9158
9168
|
isInternalEmail,
|
|
9169
|
+
isLoopbackMailHost,
|
|
9159
9170
|
isSessionFresh,
|
|
9160
9171
|
isValidPhoneNumber,
|
|
9161
9172
|
loadHostSession,
|
|
@@ -9172,6 +9183,7 @@ function parse(raw) {
|
|
|
9172
9183
|
redactSecret,
|
|
9173
9184
|
redactSmsConfig,
|
|
9174
9185
|
resolveConfig,
|
|
9186
|
+
resolveTlsRejectUnauthorized,
|
|
9175
9187
|
safeJoin,
|
|
9176
9188
|
sanitizeEmail,
|
|
9177
9189
|
saveConfig,
|
package/dist/index.d.cts
CHANGED
|
@@ -505,6 +505,22 @@ interface SendResultWithRaw extends SendResult {
|
|
|
505
505
|
/** Raw RFC822 message bytes (for appending to Sent folder) */
|
|
506
506
|
raw: Buffer;
|
|
507
507
|
}
|
|
508
|
+
/** True for loopback hosts — the bundled local mail server lives here. */
|
|
509
|
+
declare function isLoopbackMailHost(host: string | undefined): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Resolve the effective TLS `rejectUnauthorized` for a mail connection.
|
|
512
|
+
*
|
|
513
|
+
* GHSA-wjjv-3mj2-39hf made certificate verification the default — but
|
|
514
|
+
* the bundled local mail server (Stalwart on 127.0.0.1) presents a
|
|
515
|
+
* self-signed certificate, so verifying it always fails and breaks
|
|
516
|
+
* local agent-to-agent mail out of the box. A self-signed cert on a
|
|
517
|
+
* loopback address is not a meaningful MITM surface, so for loopback
|
|
518
|
+
* hosts verification defaults OFF. Remote hosts still verify by
|
|
519
|
+
* default. An explicit `tlsRejectUnauthorized` option always wins
|
|
520
|
+
* either way, so a deployment can still force-verify localhost or
|
|
521
|
+
* opt a remote host out if it really needs to.
|
|
522
|
+
*/
|
|
523
|
+
declare function resolveTlsRejectUnauthorized(host: string | undefined, explicit: boolean | undefined): boolean;
|
|
508
524
|
declare class MailSender {
|
|
509
525
|
private options;
|
|
510
526
|
private transporter;
|
|
@@ -2719,4 +2735,4 @@ declare class AgentMemoryStore {
|
|
|
2719
2735
|
renderForPrompt(memory: AgentMemoryRead | null): string;
|
|
2720
2736
|
}
|
|
2721
2737
|
|
|
2722
|
-
export { AGENT_ROLES, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryFields, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, type CachedMessage, CloudflareClient, type CreateAgentOptions, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_SESSION_MAX_AGE_MS, DNSConfigurator, type Database, type DeletionReport, type DeletionSummary, DependencyChecker, DependencyInstaller, type DependencyStatus, type DnsRecord, type DnsSetupResult, type DomainInfo, DomainManager, type DomainModeConfig, type DomainPurchaseResult, DomainPurchaser, type DomainSearchResult, type DomainSetupResult, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type HostName, type HostSession, type HostSessionResumeMode, type InboundEmail, type InboundSmsEvent, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PlanBridgeWakeArgs, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SmsProvider, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, classifyResumeError, closeDatabase, composeBridgeWakePrompt, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, getSmsProvider, hostSessionStoragePath, isInternalEmail, isSessionFresh, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseEmail, parseGoogleVoiceSms, planBridgeWake, recordToolCall, redactObject, redactSecret, redactSmsConfig, resolveConfig, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
|
|
2738
|
+
export { AGENT_ROLES, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryFields, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, type CachedMessage, CloudflareClient, type CreateAgentOptions, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_SESSION_MAX_AGE_MS, DNSConfigurator, type Database, type DeletionReport, type DeletionSummary, DependencyChecker, DependencyInstaller, type DependencyStatus, type DnsRecord, type DnsSetupResult, type DomainInfo, DomainManager, type DomainModeConfig, type DomainPurchaseResult, DomainPurchaser, type DomainSearchResult, type DomainSetupResult, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type HostName, type HostSession, type HostSessionResumeMode, type InboundEmail, type InboundSmsEvent, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PlanBridgeWakeArgs, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SmsProvider, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, classifyResumeError, closeDatabase, composeBridgeWakePrompt, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, getSmsProvider, hostSessionStoragePath, isInternalEmail, isLoopbackMailHost, isSessionFresh, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseEmail, parseGoogleVoiceSms, planBridgeWake, recordToolCall, redactObject, redactSecret, redactSmsConfig, resolveConfig, resolveTlsRejectUnauthorized, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -505,6 +505,22 @@ interface SendResultWithRaw extends SendResult {
|
|
|
505
505
|
/** Raw RFC822 message bytes (for appending to Sent folder) */
|
|
506
506
|
raw: Buffer;
|
|
507
507
|
}
|
|
508
|
+
/** True for loopback hosts — the bundled local mail server lives here. */
|
|
509
|
+
declare function isLoopbackMailHost(host: string | undefined): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Resolve the effective TLS `rejectUnauthorized` for a mail connection.
|
|
512
|
+
*
|
|
513
|
+
* GHSA-wjjv-3mj2-39hf made certificate verification the default — but
|
|
514
|
+
* the bundled local mail server (Stalwart on 127.0.0.1) presents a
|
|
515
|
+
* self-signed certificate, so verifying it always fails and breaks
|
|
516
|
+
* local agent-to-agent mail out of the box. A self-signed cert on a
|
|
517
|
+
* loopback address is not a meaningful MITM surface, so for loopback
|
|
518
|
+
* hosts verification defaults OFF. Remote hosts still verify by
|
|
519
|
+
* default. An explicit `tlsRejectUnauthorized` option always wins
|
|
520
|
+
* either way, so a deployment can still force-verify localhost or
|
|
521
|
+
* opt a remote host out if it really needs to.
|
|
522
|
+
*/
|
|
523
|
+
declare function resolveTlsRejectUnauthorized(host: string | undefined, explicit: boolean | undefined): boolean;
|
|
508
524
|
declare class MailSender {
|
|
509
525
|
private options;
|
|
510
526
|
private transporter;
|
|
@@ -2719,4 +2735,4 @@ declare class AgentMemoryStore {
|
|
|
2719
2735
|
renderForPrompt(memory: AgentMemoryRead | null): string;
|
|
2720
2736
|
}
|
|
2721
2737
|
|
|
2722
|
-
export { AGENT_ROLES, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryFields, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, type CachedMessage, CloudflareClient, type CreateAgentOptions, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_SESSION_MAX_AGE_MS, DNSConfigurator, type Database, type DeletionReport, type DeletionSummary, DependencyChecker, DependencyInstaller, type DependencyStatus, type DnsRecord, type DnsSetupResult, type DomainInfo, DomainManager, type DomainModeConfig, type DomainPurchaseResult, DomainPurchaser, type DomainSearchResult, type DomainSetupResult, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type HostName, type HostSession, type HostSessionResumeMode, type InboundEmail, type InboundSmsEvent, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PlanBridgeWakeArgs, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SmsProvider, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, classifyResumeError, closeDatabase, composeBridgeWakePrompt, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, getSmsProvider, hostSessionStoragePath, isInternalEmail, isSessionFresh, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseEmail, parseGoogleVoiceSms, planBridgeWake, recordToolCall, redactObject, redactSecret, redactSmsConfig, resolveConfig, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
|
|
2738
|
+
export { AGENT_ROLES, AccountManager, type AddressInfo, type Agent, AgentDeletionService, type AgentMemoryFields, type AgentMemoryOptions, type AgentMemoryRead, AgentMemoryStore, type AgentRole, AgenticMailClient, type AgenticMailClientOptions, type AgenticMailConfig, type ArchiveAndDeleteOptions, type ArchivedEmail, type Attachment, type AttachmentAdvisory, BRIDGE_OPERATOR_LIVE_WINDOW_MS, type BridgeMailContext, type BridgeWakeError, type BridgeWakePromptArgs, type BridgeWakeResult, type BridgeWakeRoute, type CachedMessage, CloudflareClient, type CreateAgentOptions, DEFAULT_AGENT_NAME, DEFAULT_AGENT_ROLE, DEFAULT_SESSION_MAX_AGE_MS, DNSConfigurator, type Database, type DeletionReport, type DeletionSummary, DependencyChecker, DependencyInstaller, type DependencyStatus, type DnsRecord, type DnsSetupResult, type DomainInfo, DomainManager, type DomainModeConfig, type DomainPurchaseResult, DomainPurchaser, type DomainSearchResult, type DomainSetupResult, type EmailEnvelope, type EmailRouteAction, type EmailRouteClass, type EmailRouteClassification, type EmailRouteInput, EmailSearchIndex, type FolderInfo, type GatewayConfig, GatewayManager, type GatewayManagerOptions, type GatewayMode, type GatewayStatus, type HostName, type HostSession, type HostSessionResumeMode, type InboundEmail, type InboundSmsEvent, type InboxEvent, type InboxExpungeEvent, type InboxFlagsEvent, type InboxNewEvent, InboxWatcher, type InboxWatcherOptions, type InstallProgress, type LinkAdvisory, type LocalSmtpConfig, MailReceiver, type MailReceiverOptions, MailSender, type MailSenderOptions, type MailboxInfo, type OutboundCategory, type OutboundScanInput, type OutboundScanResult, type OutboundWarning, type ParsedAttachment, type ParsedEmail, type ParsedSms, PathTraversalError, type PlanBridgeWakeArgs, type PurchasedDomain, REDACTED, RELAY_PRESETS, RelayBridge, type RelayBridgeOptions, type RelayConfig, RelayGateway, type RelayProvider, type RelaySearchResult, type ResumeErrorClassificationOptions, SPAM_THRESHOLD, type SafeJoinOptions, type SanitizeDetection, type SanitizeResult, type SearchCriteria, type SearchableEmail, type SecurityAdvisory, type SendMailOptions, type SendResult, type SendResultWithRaw, type SendSmsInput, type SendSmsResult, ServiceManager, type ServiceStatus, type SetupConfig, SetupManager, type SetupResult, type Severity, type SmsConfig, SmsManager, type SmsMessage, SmsPoller, type SmsProvider, type SpamCategory, type SpamResult, type SpamRuleMatch, StalwartAdmin, type StalwartAdminOptions, type StalwartPrincipal, ThreadCache, type ThreadCacheEntry, type ThreadCacheOptions, type ThreadIdInput, type TunnelConfig, TunnelManager, UnsafeApiUrlError, WARNING_THRESHOLD, type WatcherOptions, assertWithinBase, bridgeWakeErrorMessage, bridgeWakeLastSeenAgeMs, buildApiUrl, buildInboundSecurityAdvisory, classifyEmailRoute, classifyResumeError, closeDatabase, composeBridgeWakePrompt, createTestDatabase, debug, debugWarn, ensureDataDir, extractVerificationCode, flushTelemetry, forgetHostSession, getDatabase, getOperatorEmail, getSmsProvider, hostSessionStoragePath, isInternalEmail, isLoopbackMailHost, isSessionFresh, isValidPhoneNumber, loadHostSession, mapProviderSmsStatus, normalizeAddress, normalizePhoneNumber, normalizeSubject, operatorPrefsStoragePath, parseEmail, parseGoogleVoiceSms, planBridgeWake, recordToolCall, redactObject, redactSecret, redactSmsConfig, resolveConfig, resolveTlsRejectUnauthorized, safeJoin, sanitizeEmail, saveConfig, saveHostSession, scanOutboundEmail, scoreEmail, setOperatorEmail, setTelemetryVersion, shouldSkipBridgeWakeForLiveOperator, startRelayBridge, threadIdFor, tryJoin, validateApiUrl };
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,14 @@ import {
|
|
|
11
11
|
// src/mail/sender.ts
|
|
12
12
|
import nodemailer from "nodemailer";
|
|
13
13
|
import MailComposer from "nodemailer/lib/mail-composer/index.js";
|
|
14
|
+
function isLoopbackMailHost(host) {
|
|
15
|
+
const h = (host ?? "").trim().toLowerCase().replace(/^\[|\]$/g, "");
|
|
16
|
+
return h === "localhost" || h === "::1" || h.endsWith(".localhost") || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h);
|
|
17
|
+
}
|
|
18
|
+
function resolveTlsRejectUnauthorized(host, explicit) {
|
|
19
|
+
if (explicit !== void 0) return explicit;
|
|
20
|
+
return !isLoopbackMailHost(host);
|
|
21
|
+
}
|
|
14
22
|
var MailSender = class {
|
|
15
23
|
constructor(options) {
|
|
16
24
|
this.options = options;
|
|
@@ -24,7 +32,7 @@ var MailSender = class {
|
|
|
24
32
|
pass: options.password
|
|
25
33
|
},
|
|
26
34
|
tls: {
|
|
27
|
-
rejectUnauthorized: options.tlsRejectUnauthorized
|
|
35
|
+
rejectUnauthorized: resolveTlsRejectUnauthorized(options.host, options.tlsRejectUnauthorized)
|
|
28
36
|
},
|
|
29
37
|
connectionTimeout: 1e4,
|
|
30
38
|
// 10s to establish TCP connection
|
|
@@ -8377,6 +8385,7 @@ export {
|
|
|
8377
8385
|
getSmsProvider,
|
|
8378
8386
|
hostSessionStoragePath,
|
|
8379
8387
|
isInternalEmail,
|
|
8388
|
+
isLoopbackMailHost,
|
|
8380
8389
|
isSessionFresh,
|
|
8381
8390
|
isValidPhoneNumber,
|
|
8382
8391
|
loadHostSession,
|
|
@@ -8393,6 +8402,7 @@ export {
|
|
|
8393
8402
|
redactSecret,
|
|
8394
8403
|
redactSmsConfig,
|
|
8395
8404
|
resolveConfig,
|
|
8405
|
+
resolveTlsRejectUnauthorized,
|
|
8396
8406
|
safeJoin,
|
|
8397
8407
|
sanitizeEmail,
|
|
8398
8408
|
saveConfig,
|