@push.rocks/smartmta 9.5.0 → 9.6.1

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.
Files changed (44) hide show
  1. package/changelog.md +41 -0
  2. package/dist_rust/mailer-bin_linux_amd64 +0 -0
  3. package/dist_rust/mailer-bin_linux_amd64.tsrust-build.json +14 -0
  4. package/dist_rust/mailer-bin_linux_arm64 +0 -0
  5. package/dist_rust/mailer-bin_linux_arm64.tsrust-build.json +14 -0
  6. package/dist_ts/00_commitinfo_data.js +1 -1
  7. package/dist_ts/index.d.ts +1 -0
  8. package/dist_ts/index.js +2 -1
  9. package/dist_ts/mail/routing/classes.unified.email.server.d.ts +140 -4
  10. package/dist_ts/mail/routing/classes.unified.email.server.js +371 -97
  11. package/dist_ts/mail/routing/interfaces.d.ts +41 -0
  12. package/notices/aws-lc-sys-0.43.0-fiat-license.txt +22 -0
  13. package/notices/cargo-dependencies.html +4706 -0
  14. package/notices/compiler-builtins-license.txt +275 -0
  15. package/notices/crossbeam-channel-third-party.txt +593 -0
  16. package/notices/encoding-rs-copyright.txt +61 -0
  17. package/notices/glibc-copying-lesser.txt +502 -0
  18. package/notices/glibc-licenses.txt +412 -0
  19. package/notices/inventory.json +1226 -0
  20. package/notices/libgcc-gpl-3.0.txt +674 -0
  21. package/notices/libgcc-runtime-exception.txt +73 -0
  22. package/notices/mimalloc-license.txt +21 -0
  23. package/notices/moka-notice.txt +14 -0
  24. package/notices/ring-0.17.14-fiat-license.txt +15 -0
  25. package/notices/ring-0.17.14-license-boringssl.txt +272 -0
  26. package/notices/ring-0.17.14-license-other-bits.txt +13 -0
  27. package/notices/ring-0.17.14-license.txt +9 -0
  28. package/notices/ring-0.17.14-once-cell-license-apache.txt +201 -0
  29. package/notices/ring-0.17.14-once-cell-license-mit.txt +23 -0
  30. package/notices/rust-standard-library.html +8266 -0
  31. package/notices/rustversion-1.0.23-license-mit.txt +23 -0
  32. package/notices/source-attributions.txt +294 -0
  33. package/notices/wasm-bindgen-license-mit.txt +25 -0
  34. package/notices/zerocopy-derive-0.8.55-license-mit.txt +26 -0
  35. package/notices/zstd-license.txt +30 -0
  36. package/package.json +8 -6
  37. package/readme.md +70 -2
  38. package/third-party-notices.md +171 -0
  39. package/ts/00_commitinfo_data.ts +1 -1
  40. package/ts/index.ts +1 -0
  41. package/ts/mail/routing/classes.unified.email.server.ts +452 -108
  42. package/ts/mail/routing/interfaces.ts +43 -0
  43. package/readme.hints.md +0 -45
  44. package/readme.plan.md +0 -30
@@ -203,6 +203,49 @@ export interface ISmtpAuthAccount {
203
203
  scope?: ISmtpAuthAccountScope;
204
204
  }
205
205
 
206
+ /**
207
+ * Context handed to `hooks.onAuthenticate` for a PLAIN/LOGIN attempt whose
208
+ * username is not declared in `auth.accounts` or `auth.users`.
209
+ */
210
+ export interface ISmtpAuthenticateContext {
211
+ /** Username exactly as supplied by the client. */
212
+ username: string;
213
+ /** Password exactly as supplied by the client. */
214
+ password: string;
215
+ /** SMTP session the attempt belongs to. */
216
+ sessionId: string;
217
+ /** Remote peer address of the SMTP connection. */
218
+ remoteAddress: string;
219
+ /** Aborted when the hook exceeds `smtp.authenticationTimeoutMs`. */
220
+ abortSignal?: AbortSignal;
221
+ }
222
+
223
+ /**
224
+ * Result of an `hooks.onAuthenticate` credential verification.
225
+ */
226
+ export interface ISmtpAuthenticateDecision {
227
+ /** Whether the supplied credential is valid. */
228
+ accepted: boolean;
229
+ /**
230
+ * Reason for a rejection, recorded in the server log.
231
+ *
232
+ * It is deliberately NOT sent to the client: the SMTP listener answers every
233
+ * failed authentication with the same `535 5.7.8 Authentication credentials
234
+ * invalid`, so a caller cannot probe which usernames exist. Use this to make
235
+ * an operator's log say why a binding was refused.
236
+ */
237
+ message?: string;
238
+ /**
239
+ * Send-authorization scope for the resulting session, enforced identically
240
+ * to a configured account's scope for the lifetime of that session.
241
+ *
242
+ * Absent scope = unrestricted, matching `ISmtpAuthAccount.scope`. A hook
243
+ * that authenticates tenants MUST return a scope; without one the session
244
+ * may send as any sender to any recipient.
245
+ */
246
+ scope?: ISmtpAuthAccountScope;
247
+ }
248
+
206
249
  /**
207
250
  * Context for route evaluation
208
251
  */
package/readme.hints.md DELETED
@@ -1,45 +0,0 @@
1
- # Project Hints
2
-
3
- ## Rust Workspace
4
- - Rust code lives in `rust/` with a Cargo workspace
5
- - Crates: `mailer-core`, `mailer-smtp`, `mailer-security`, `mailer-napi`, `mailer-bin`
6
- - `mailer-bin` is the binary target that `tsrust` builds for cross-compilation
7
- - `mailer-napi` is a cdylib for N-API bindings (not built by tsrust, needs separate napi-rs build pipeline)
8
- - tsrust only supports binary targets (looks for `src/main.rs` or `[[bin]]` entries)
9
- - Cross-compilation targets: `linux_amd64`, `linux_arm64` (configured in `.smartconfig.json`)
10
- - Build output goes to `dist_rust/`
11
-
12
- ## Build
13
- - `pnpm build` runs `tsbuild tsfolders && tsrust`
14
- - `pnpm run check` uses `@git.zone/tsbuild` 4.4.2 for production and test type checks
15
- - `tsrust` independently works and produces binaries in `dist_rust/`
16
-
17
- ## Key Dependencies (Rust)
18
- - `tokio` - async runtime
19
- - `tokio-rustls` - TLS
20
- - `hickory-dns` (hickory-resolver) - DNS resolution
21
- - `mail-auth` - DKIM/SPF/DMARC (by Stalwart Labs)
22
- - `mailparse` - MIME parsing
23
- - `napi` + `napi-derive` - Node.js bindings
24
- - `ring` - crypto primitives
25
- - `dashmap` - concurrent hash maps
26
-
27
- ## Static Rust Binaries
28
-
29
- - The Rust binaries in `dist_rust/` are statically linked (static-pie) via `"static": true` in the `@git.zone/tsrust` block of `.smartconfig.json` (tsrust >= 1.4.1). They run on both glibc (Debian/Ubuntu) and musl (Alpine) systems.
30
- - tsrust injects `RUSTFLAGS="-C target-feature=+crt-static"` only into its own per-target cargo invocations and verifies the result (no `PT_INTERP` ELF header). Keep `rust/.cargo/config.toml` free of `rustflags` entries: the injected env variable would replace them, and a repo-wide `rustflags` would also break plain `cargo test`/`cargo check` (proc-macros cannot build with `+crt-static` on linux-gnu without an explicit `--target`).
31
- - `pnpm run test:rust` runs the Rust unit tests; plain `cargo test` in `rust/` works as well.
32
- - Verify linkage manually with `ldd dist_rust/<binary>_linux_amd64` → "statically linked".
33
-
34
- ## Type Checking
35
-
36
- - `@git.zone/tsbuild` is pinned at 4.4.2 and the stricter production/test checks are clean.
37
- - Do not downgrade tsbuild or add `skipLibCheck` to production configuration; fix source types at their origin.
38
-
39
- ## Raw Queue Schema
40
-
41
- - Structured queue records continue to write schema V2 and read V1/V2. Only durable raw outbound records use schema V3.
42
- - A V3 record stores metadata and canonical CRLF-terminated exact unsigned RFC822 bytes in the same managed blob. Queue memory and public snapshots retain metadata only.
43
- - Raw-operation reservations charge enqueue at 3x and payload access, persistence, and direct send at 6x message length; the default 32 MiB message limit therefore requires the default 192 MiB budget. A separate 1,024-reservation cap bounds fixed per-operation overhead, and shutdown drains accepted reservations.
44
- - Managed queue startup uses `listPage()` when available so hydration never materializes the complete key listing in memory.
45
- - SmartMTA 9.4 is safe only after a current queue inventory contains zero `messageFormat: 'raw-rfc822'` items. Queue prefixes require one deployment-wide writer; the in-process ownership guard is not a distributed lease.
package/readme.plan.md DELETED
@@ -1,30 +0,0 @@
1
- # Rust Migration Plan
2
-
3
- ## Completed Phases
4
-
5
- ### Phase 6: Durable Per-Recipient Delivery And Bounce Outbox
6
- - Queue schema V2 stores explicit recipient dispositions and deterministic bounce operations in managed blob storage
7
- - Final 250 acceptance, permanent 5xx terminal state, and unresolved 4xx retry semantics are checkpointed per recipient
8
- - Built-in bounce processing is idempotent by operation ID; custom handlers receive the ID for at-least-once deduplication
9
- - Queue and delivery observers are isolated from committed state, statistics, and downstream listeners
10
-
11
- ### Phase 3: Rust Primary Backend (DKIM/SPF/DMARC/IP Reputation)
12
- - Rust is the mandatory security backend — no TS fallbacks
13
- - All DKIM signing/verification, SPF, DMARC, IP reputation through Rust bridge
14
-
15
- ### Phase 5: BounceManager + ContentScanner
16
- - BounceManager bounce detection delegated to Rust `detectBounce` IPC command
17
- - ContentScanner pattern matching delegated to new Rust `scanContent` IPC command
18
- - New module: `rust/crates/mailer-security/src/content_scanner.rs` (10 Rust tests)
19
- - ~215 lines removed from BounceManager, ~350 lines removed from ContentScanner
20
- - Binary attachment scanning (PE headers, VBA macros) stays in TS
21
- - Custom rules (runtime-configured) stay in TS
22
- - Net change: ~-560 TS lines, +265 Rust lines
23
-
24
- ## Deferred
25
-
26
- | Component | Rationale |
27
- |-----------|-----------|
28
- | EmailValidator | Already thin; uses smartmail; minimal gain |
29
- | DNS record generation | Pure string building; zero benefit from Rust |
30
- | MIME building (`toRFC822String`) | Sync in TS, async via IPC; too much blast radius |