@bymax-one/nest-notification 1.0.5 → 1.0.6

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/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.6] - 2026-08-10
11
+
12
+ Remediation of a local audit's development-log privacy finding (merged in #55). No API changed.
13
+
14
+ ### Fixed
15
+
16
+ - **The no-op email provider no longer logs the recipient in clear, the subject, or the body.** The
17
+ development provider now logs only a first-initial mask of each recipient (`m***@example.com`).
18
+ The subject is dropped entirely: it is rendered from a consumer template that can interpolate an
19
+ OTP code, so logging it could persist a real code in a developer's log, violating the
20
+ never-log-codes invariant.
21
+
10
22
  ## [1.0.5] - 2026-08-08
11
23
 
12
24
  **Documentation only.** `dist/` is byte-identical to `1.0.4`; no source file changed.
@@ -181,7 +193,8 @@ rejected at startup rather than failing on the first send.
181
193
 
182
194
  [1.0.4]: https://github.com/bymaxone/nest-notification/compare/v1.0.3...v1.0.4
183
195
  [1.0.3]: https://github.com/bymaxone/nest-notification/compare/v1.0.2...v1.0.3
184
- [Unreleased]: https://github.com/bymaxone/nest-notification/compare/v1.0.5...HEAD
196
+ [Unreleased]: https://github.com/bymaxone/nest-notification/compare/v1.0.6...HEAD
197
+ [1.0.6]: https://github.com/bymaxone/nest-notification/compare/v1.0.5...v1.0.6
185
198
  [1.0.5]: https://github.com/bymaxone/nest-notification/compare/v1.0.4...v1.0.5
186
199
  [1.0.2]: https://github.com/bymaxone/nest-notification/compare/v1.0.1...v1.0.2
187
200
  [1.0.1]: https://github.com/bymaxone/nest-notification/compare/v1.0.0...v1.0.1
@@ -1552,6 +1552,13 @@ var CANONICAL_EMAIL_TEMPLATES = {
1552
1552
  /** MFA disabled — variables: `name`, `appName`. */
1553
1553
  MFA_DISABLED: "mfa_disabled"
1554
1554
  };
1555
+ function maskEmail(address) {
1556
+ const at = address.lastIndexOf("@");
1557
+ if (at <= 0) {
1558
+ return "***";
1559
+ }
1560
+ return `${address[0]}***${address.slice(at)}`;
1561
+ }
1555
1562
  exports.NoOpEmailProvider = class NoOpEmailProvider {
1556
1563
  constructor() {
1557
1564
  this.name = "noop";
@@ -1562,14 +1569,17 @@ exports.NoOpEmailProvider = class NoOpEmailProvider {
1562
1569
  return true;
1563
1570
  }
1564
1571
  /**
1565
- * Pretends to send: logs the recipient and subject and returns a synthetic id.
1572
+ * Pretends to send: logs a masked recipient and returns a synthetic id.
1566
1573
  *
1567
- * @param options - The message to "send". Only `to` and `subject` are logged.
1574
+ * @param options - The message to "send". Only a masked `to` is logged — never
1575
+ * the subject or the body, since a consumer template can interpolate an OTP
1576
+ * code into either.
1568
1577
  * @returns A synthetic `messageId` prefixed with `noop-`.
1569
1578
  */
1570
1579
  async send(options) {
1571
- const to = Array.isArray(options.to) ? options.to.join(",") : options.to;
1572
- this.logger.debug(`[NoOpEmail] to=${to} subject="${options.subject}"`);
1580
+ const recipients = Array.isArray(options.to) ? options.to : [options.to];
1581
+ const masked = recipients.map(maskEmail).join(",");
1582
+ this.logger.debug(`[NoOpEmail] to=${masked}`);
1573
1583
  return { messageId: `noop-${crypto.randomUUID()}` };
1574
1584
  }
1575
1585
  };
@@ -1251,8 +1251,9 @@ type CanonicalEmailTemplate = (typeof CANONICAL_EMAIL_TEMPLATES)[keyof typeof CA
1251
1251
  * @fileoverview Development email provider that logs instead of sending.
1252
1252
  * @layer infrastructure
1253
1253
  *
1254
- * Useful for local development without SMTP credentials. It logs only the
1255
- * recipient and subject — NEVER the body, which may carry OTP codes or PII.
1254
+ * Useful for local development without SMTP credentials. It logs only a MASKED
1255
+ * recipient — never the full address, and never the subject or the body, either
1256
+ * of which a consumer template can interpolate an OTP code or other PII into.
1256
1257
  *
1257
1258
  * DO NOT USE IN PRODUCTION.
1258
1259
  */
@@ -1264,9 +1265,11 @@ declare class NoOpEmailProvider implements IEmailProvider {
1264
1265
  /** Always ready — the no-op provider has nothing to configure. */
1265
1266
  isConfigured(): boolean;
1266
1267
  /**
1267
- * Pretends to send: logs the recipient and subject and returns a synthetic id.
1268
+ * Pretends to send: logs a masked recipient and returns a synthetic id.
1268
1269
  *
1269
- * @param options - The message to "send". Only `to` and `subject` are logged.
1270
+ * @param options - The message to "send". Only a masked `to` is logged — never
1271
+ * the subject or the body, since a consumer template can interpolate an OTP
1272
+ * code into either.
1270
1273
  * @returns A synthetic `messageId` prefixed with `noop-`.
1271
1274
  */
1272
1275
  send(options: EmailSendOptions): Promise<EmailSendResult>;
@@ -1251,8 +1251,9 @@ type CanonicalEmailTemplate = (typeof CANONICAL_EMAIL_TEMPLATES)[keyof typeof CA
1251
1251
  * @fileoverview Development email provider that logs instead of sending.
1252
1252
  * @layer infrastructure
1253
1253
  *
1254
- * Useful for local development without SMTP credentials. It logs only the
1255
- * recipient and subject — NEVER the body, which may carry OTP codes or PII.
1254
+ * Useful for local development without SMTP credentials. It logs only a MASKED
1255
+ * recipient — never the full address, and never the subject or the body, either
1256
+ * of which a consumer template can interpolate an OTP code or other PII into.
1256
1257
  *
1257
1258
  * DO NOT USE IN PRODUCTION.
1258
1259
  */
@@ -1264,9 +1265,11 @@ declare class NoOpEmailProvider implements IEmailProvider {
1264
1265
  /** Always ready — the no-op provider has nothing to configure. */
1265
1266
  isConfigured(): boolean;
1266
1267
  /**
1267
- * Pretends to send: logs the recipient and subject and returns a synthetic id.
1268
+ * Pretends to send: logs a masked recipient and returns a synthetic id.
1268
1269
  *
1269
- * @param options - The message to "send". Only `to` and `subject` are logged.
1270
+ * @param options - The message to "send". Only a masked `to` is logged — never
1271
+ * the subject or the body, since a consumer template can interpolate an OTP
1272
+ * code into either.
1270
1273
  * @returns A synthetic `messageId` prefixed with `noop-`.
1271
1274
  */
1272
1275
  send(options: EmailSendOptions): Promise<EmailSendResult>;
@@ -1550,6 +1550,13 @@ var CANONICAL_EMAIL_TEMPLATES = {
1550
1550
  /** MFA disabled — variables: `name`, `appName`. */
1551
1551
  MFA_DISABLED: "mfa_disabled"
1552
1552
  };
1553
+ function maskEmail(address) {
1554
+ const at = address.lastIndexOf("@");
1555
+ if (at <= 0) {
1556
+ return "***";
1557
+ }
1558
+ return `${address[0]}***${address.slice(at)}`;
1559
+ }
1553
1560
  var NoOpEmailProvider = class {
1554
1561
  constructor() {
1555
1562
  this.name = "noop";
@@ -1560,14 +1567,17 @@ var NoOpEmailProvider = class {
1560
1567
  return true;
1561
1568
  }
1562
1569
  /**
1563
- * Pretends to send: logs the recipient and subject and returns a synthetic id.
1570
+ * Pretends to send: logs a masked recipient and returns a synthetic id.
1564
1571
  *
1565
- * @param options - The message to "send". Only `to` and `subject` are logged.
1572
+ * @param options - The message to "send". Only a masked `to` is logged — never
1573
+ * the subject or the body, since a consumer template can interpolate an OTP
1574
+ * code into either.
1566
1575
  * @returns A synthetic `messageId` prefixed with `noop-`.
1567
1576
  */
1568
1577
  async send(options) {
1569
- const to = Array.isArray(options.to) ? options.to.join(",") : options.to;
1570
- this.logger.debug(`[NoOpEmail] to=${to} subject="${options.subject}"`);
1578
+ const recipients = Array.isArray(options.to) ? options.to : [options.to];
1579
+ const masked = recipients.map(maskEmail).join(",");
1580
+ this.logger.debug(`[NoOpEmail] to=${masked}`);
1571
1581
  return { messageId: `noop-${randomUUID()}` };
1572
1582
  }
1573
1583
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bymax-one/nest-notification",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Multi-channel notification library for NestJS — email, OTP, SMS, push — with pluggable providers and storage, multi-tenant by design, zero runtime dependencies.",
5
5
  "author": "Bymax One <support@bymax.one>",
6
6
  "license": "MIT",