@bymax-one/nest-notification 1.0.4 → 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,32 @@ 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
+
22
+ ## [1.0.5] - 2026-08-08
23
+
24
+ **Documentation only.** `dist/` is byte-identical to `1.0.4`; no source file changed.
25
+
26
+ ### Fixed
27
+
28
+ - **The README understated the mutation score.** The badge and
29
+ `docs/mutation_testing_results.md` both record **100%** with no survivors, measured in the
30
+ 2026-08-06 re-run — but the prose bullet beside them still said **98.17%**, and cited "857
31
+ of 873 viable seeded faults killed" from the pass before it. The badge and the report were
32
+ updated and the sentence between them was not, so the npm page has been claiming less than
33
+ the package delivers.
34
+ - The `[Unreleased]` compare link still pointed at `v1.0.3` after `1.0.4` shipped.
35
+
10
36
  ## [1.0.4] - 2026-08-06
11
37
 
12
38
  **Published-artifact change, not a behavioural one.** `dist/` differs from `1.0.3` — this
@@ -167,7 +193,9 @@ rejected at startup rather than failing on the first send.
167
193
 
168
194
  [1.0.4]: https://github.com/bymaxone/nest-notification/compare/v1.0.3...v1.0.4
169
195
  [1.0.3]: https://github.com/bymaxone/nest-notification/compare/v1.0.2...v1.0.3
170
- [Unreleased]: https://github.com/bymaxone/nest-notification/compare/v1.0.3...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
198
+ [1.0.5]: https://github.com/bymaxone/nest-notification/compare/v1.0.4...v1.0.5
171
199
  [1.0.2]: https://github.com/bymaxone/nest-notification/compare/v1.0.1...v1.0.2
172
200
  [1.0.1]: https://github.com/bymaxone/nest-notification/compare/v1.0.0...v1.0.1
173
201
  [1.0.0]: https://github.com/bymaxone/nest-notification/releases/tag/v1.0.0
package/README.md CHANGED
@@ -634,7 +634,7 @@ When integrating `@bymax-one/nest-notification` in production, verify each of th
634
634
  A one-time password is a credential, so the suite is held to a bar beyond "it runs" — every behavior is pinned so that a regression **fails a test**.
635
635
 
636
636
  - ✅ **100% line coverage** — statements, branches, functions, and lines, enforced per file as a release gate across unit + e2e
637
- - ✅ **98.17% mutation score** — verified with [Stryker](https://stryker-mutator.io/): 857 of 873 viable seeded faults killed, against a `break` threshold of 95 and driven toward 100
637
+ - ✅ **100% mutation score** — verified with [Stryker](https://stryker-mutator.io/): every viable seeded fault killed, with **no survivors**, against a `break` threshold of 95. The equivalents that no test can kill carry their reason on the line they apply to, so the number is an accounting rather than a target
638
638
  - ✅ **384 tests** — unit and end-to-end, spanning all three subpaths
639
639
  - ✅ **Invariants asserted, not assumed** — the never-log-codes rule is a test (`JSON.stringify(entry).includes(code) === false`), not a review convention
640
640
  - ✅ **Published shape verified** — `attw` resolves every entrypoint against the packed tarball, and a dogfood smoke test installs the package into a scratch consumer before any tag is cut
@@ -644,7 +644,7 @@ A one-time password is a credential, so the suite is held to a bar beyond "it ru
644
644
  | -------------- | ---------------------------------------------------------------------- |
645
645
  | Type safety | TypeScript `strict`, zero `any` |
646
646
  | Coverage | **100%** line/branch/function/statement per file (`pnpm test:cov:all`) |
647
- | Mutation | Stryker score **≥ 95%** (`break: 95`), currently **98.17%** |
647
+ | Mutation | Stryker score **≥ 95%** (`break: 95`), currently **100%** |
648
648
  | Lint | ESLint flat config + `eslint-plugin-security`, zero warnings |
649
649
  | Bundle budgets | server < 30 KB · shared < 4 KB · react < 8 KB brotli (`pnpm size`) |
650
650
  | Prisma-free | `pnpm check:no-prisma` — the library never imports `@prisma/client` |
@@ -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.4",
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",
@@ -69,16 +69,17 @@
69
69
  "scripts": {
70
70
  "build": "pnpm clean && tsup",
71
71
  "check:exports": "attw --pack .",
72
+ "check:mutants": "node scripts/check-mutation-directives.mjs",
72
73
  "check:no-prisma": "grep -rq '@prisma/client' src; s=$?; [ $s -eq 1 ] && exit 0; [ $s -eq 0 ] && { echo check:no-prisma: found @prisma/client import in src/; exit 1; }; echo check:no-prisma: grep failed with exit $s; exit $s",
73
74
  "check:published": "node scripts/check-published-surface.mjs",
74
75
  "clean": "rm -rf dist coverage",
75
76
  "lint": "eslint src scripts test",
76
77
  "lint:fix": "eslint src scripts test --fix",
77
78
  "mutation": "stryker run",
79
+ "mutation:full": "node -e \"require('node:fs').rmSync('reports/stryker-incremental.json',{force:true,recursive:true})\" && stryker run",
78
80
  "mutation:dry-run": "stryker run --dryRunOnly",
79
- "mutation:incremental": "stryker run --incremental",
80
81
  "prepare": "husky",
81
- "prepublishOnly": "pnpm clean && pnpm typecheck && pnpm test:types && pnpm lint && pnpm check:no-prisma && pnpm test:cov:all && pnpm build && pnpm check:published",
82
+ "prepublishOnly": "pnpm clean && pnpm typecheck && pnpm test:types && pnpm lint && pnpm check:mutants && pnpm check:no-prisma && pnpm test:cov:all && pnpm build && pnpm check:published",
82
83
  "release": "npm publish --provenance --access public",
83
84
  "size": "node scripts/check-size.mjs",
84
85
  "smoke": "node scripts/dogfood-smoke-test.mjs",