@blamejs/core 0.8.52 → 0.8.58

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 (45) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/index.js +8 -0
  3. package/lib/audit.js +4 -0
  4. package/lib/auth/fido-mds3.js +624 -0
  5. package/lib/auth/passkey.js +214 -2
  6. package/lib/auth-bot-challenge.js +1 -1
  7. package/lib/credential-hash.js +2 -2
  8. package/lib/db-collection.js +290 -0
  9. package/lib/db-query.js +245 -0
  10. package/lib/db.js +173 -67
  11. package/lib/framework-error.js +55 -0
  12. package/lib/guard-cidr.js +2 -1
  13. package/lib/guard-jwt.js +2 -2
  14. package/lib/guard-oauth.js +2 -2
  15. package/lib/http-client-cache.js +916 -0
  16. package/lib/http-client.js +242 -0
  17. package/lib/mail-arf.js +343 -0
  18. package/lib/mail-auth.js +265 -40
  19. package/lib/mail-bimi.js +948 -33
  20. package/lib/mail-bounce.js +386 -4
  21. package/lib/mail-mdn.js +424 -0
  22. package/lib/mail-unsubscribe.js +265 -25
  23. package/lib/mail.js +403 -21
  24. package/lib/middleware/bearer-auth.js +1 -1
  25. package/lib/middleware/clear-site-data.js +122 -0
  26. package/lib/middleware/dpop.js +1 -1
  27. package/lib/middleware/index.js +9 -0
  28. package/lib/middleware/nel.js +214 -0
  29. package/lib/middleware/security-headers.js +56 -4
  30. package/lib/middleware/speculation-rules.js +323 -0
  31. package/lib/mime-parse.js +198 -0
  32. package/lib/mtls-ca.js +15 -5
  33. package/lib/network-dns.js +890 -27
  34. package/lib/network-tls.js +745 -0
  35. package/lib/object-store/sigv4.js +54 -0
  36. package/lib/public-suffix.js +414 -0
  37. package/lib/safe-buffer.js +7 -0
  38. package/lib/safe-json.js +1 -1
  39. package/lib/static.js +120 -0
  40. package/lib/storage.js +11 -0
  41. package/lib/vendor/MANIFEST.json +33 -0
  42. package/lib/vendor/bimi-trust-anchors.pem +33 -0
  43. package/lib/vendor/public-suffix-list.dat +16376 -0
  44. package/package.json +1 -1
  45. package/sbom.cyclonedx.json +6 -6
@@ -378,6 +378,19 @@ var SmtpPolicyError = defineClass("SmtpPolicyError", { alwaysPermane
378
378
  // record shape, fetch failures, missing keys, alignment issues.
379
379
  // Permanent — DNS-config / message-shape errors, not transient.
380
380
  var MailAuthError = defineClass("MailAuthError", { alwaysPermanent: true });
381
+ // MailArfError covers RFC 5965 Abuse Reporting Format ingest failures:
382
+ // missing required Feedback-Type / User-Agent fields, malformed
383
+ // multipart/report, message/feedback-report MIME-type mismatch, parse
384
+ // errors. Permanent — the report shape is operator-supplied input.
385
+ var MailArfError = defineClass("MailArfError", { alwaysPermanent: true });
386
+ // MailBimiError covers RFC 9091 BIMI VMC / CMC chain validation
387
+ // + Tiny-PS SVG profile violations: VMC fetch failures, X.509 chain
388
+ // validation failures, subjectAltName URI / BIMI domain mismatch,
389
+ // missing BIMI policy OID (1.3.6.1.5.5.7.3.31 mark verification),
390
+ // Tiny-PS SVG profile violations (root, version, baseProfile, scripts,
391
+ // external refs, viewBox, byte cap). Permanent — every case is a
392
+ // brand / certificate / asset shape error.
393
+ var MailBimiError = defineClass("MailBimiError", { alwaysPermanent: true });
381
394
  // SseError covers Server-Sent Events stream-shape violations: newline
382
395
  // or CR or NUL injection in event:/id:/data: fields (CVE-2026-33128
383
396
  // h3, CVE-2026-29085 Hono, CVE-2026-44217 sse-channel — newline in
@@ -553,10 +566,47 @@ var DaemonError = defineClass("DaemonError", { alwaysPermane
553
566
  // framework refuses to coerce. Operators wrap the call in their own
554
567
  // retry policy when polling against a flaky CDN.
555
568
  var SelfUpdateError = defineClass("SelfUpdateError", { alwaysPermanent: true });
569
+ // MailUnsubscribeError — b.mail.unsubscribe (lib/mail-unsubscribe.js).
570
+ // RFC 8058 / RFC 2369 / RFC 2919 List-* header builder violations:
571
+ // non-https URL in url/help/archive, non-mailto in mailto/owner,
572
+ // invalid list-id shape per RFC 2919 §3, control bytes / over-length
573
+ // header values. alwaysPermanent — every case is operator-misconfig
574
+ // at config-time the framework refuses to coerce.
575
+ var MailUnsubscribeError = defineClass("MailUnsubscribeError", { alwaysPermanent: true });
576
+ // FidoMds3Error — b.auth.fidoMds3 (lib/auth/fido-mds3.js). FIDO MDS3
577
+ // metadata BLOB verification + AAGUID lookup violations: BLOB fetch
578
+ // failure (non-2xx, oversize, network), JWS shape mismatch, certificate
579
+ // chain validation failure against the FIDO Alliance MDS3 root,
580
+ // signature verification failure, payload schema violation
581
+ // (missing entries / nextUpdate / no), nextUpdate parse failure,
582
+ // AAGUID lookup against an authenticator carrying a REVOKED /
583
+ // USER_KEY_PHYSICAL_COMPROMISE / USER_KEY_REMOTE_COMPROMISE status
584
+ // report. alwaysPermanent — every case is configuration / network /
585
+ // signing-shape errors that retry alone won't recover.
586
+ var FidoMds3Error = defineClass("FidoMds3Error", { alwaysPermanent: true });
587
+ // PublicSuffixError — b.publicSuffix (lib/public-suffix.js). Bad
588
+ // domain input at lookup time (non-string, empty, overlong, control-
589
+ // byte-bearing, IDN-normalization failure) and missing-vendored-data
590
+ // at module-init are both alwaysPermanent — every case is operator-
591
+ // shaped (caller passed garbage) or packaging-shaped (vendored .dat
592
+ // missing). Codes: `public-suffix/invalid-domain`,
593
+ // `public-suffix/not-loaded`.
594
+ var PublicSuffixError = defineClass("PublicSuffixError", { alwaysPermanent: true });
595
+ // MailMdnError — b.mailMdn (lib/mail-mdn.js). RFC 3798 / RFC 8098
596
+ // Message Disposition Notification builder + parser violations: bad
597
+ // opts at build/parse, malformed multipart/report shape, missing
598
+ // required fields (Original-Recipient / Final-Recipient / Disposition),
599
+ // disposition / action-mode / sending-mode token allowlist drift,
600
+ // auto-generation refusal when the inbound message demanded user
601
+ // confirmation (RFC 3798 §2.1) and the operator did not opt in.
602
+ // alwaysPermanent — every case is operator-shape or message-shape
603
+ // errors that retry will not recover.
604
+ var MailMdnError = defineClass("MailMdnError", { alwaysPermanent: true });
556
605
 
557
606
  module.exports = {
558
607
  FrameworkError: FrameworkError,
559
608
  defineClass: defineClass,
609
+ MailUnsubscribeError: MailUnsubscribeError,
560
610
  ObjectStoreError: ObjectStoreError,
561
611
  LogStreamError: LogStreamError,
562
612
  QueueError: QueueError,
@@ -613,6 +663,8 @@ module.exports = {
613
663
  ComplianceError: ComplianceError,
614
664
  SmtpPolicyError: SmtpPolicyError,
615
665
  MailAuthError: MailAuthError,
666
+ MailArfError: MailArfError,
667
+ MailBimiError: MailBimiError,
616
668
  SseError: SseError,
617
669
  McpError: McpError,
618
670
  AiInputError: AiInputError,
@@ -641,4 +693,7 @@ module.exports = {
641
693
  ArgParserError: ArgParserError,
642
694
  DaemonError: DaemonError,
643
695
  SelfUpdateError: SelfUpdateError,
696
+ FidoMds3Error: FidoMds3Error,
697
+ PublicSuffixError: PublicSuffixError,
698
+ MailMdnError: MailMdnError,
644
699
  };
package/lib/guard-cidr.js CHANGED
@@ -48,6 +48,7 @@ var lazyRequire = require("./lazy-require");
48
48
  var gateContract = require("./gate-contract");
49
49
  var C = require("./constants");
50
50
  var numericBounds = require("./numeric-bounds");
51
+ var safeBuffer = require("./safe-buffer");
51
52
  var { GuardCidrError } = require("./framework-error");
52
53
 
53
54
  var observability = lazyRequire(function () { return require("./observability"); });
@@ -202,7 +203,7 @@ function _parseIpv6(s) {
202
203
  var out = [];
203
204
  for (var i = 0; i < parts.length; i += 1) {
204
205
  var p = parts[i];
205
- if (!/^[0-9a-fA-F]{1,4}$/.test(p)) return null;
206
+ if (!safeBuffer.IPV6_HEXTET_RE.test(p)) return null;
206
207
  out.push(p.toLowerCase());
207
208
  }
208
209
  return out;
package/lib/guard-jwt.js CHANGED
@@ -437,7 +437,7 @@ function _detectIssues(input, opts) {
437
437
  * @since 0.7.49
438
438
  * @status stable
439
439
  * @compliance hipaa, pci-dss, gdpr, soc2
440
- * @related b.guardJwt.sanitize, b.guardJwt.gate, b.auth.jwt.verifyExternal
440
+ * @related b.guardJwt.sanitize, b.guardJwt.gate
441
441
  *
442
442
  * Apply the full guard-jwt threat catalog to a JWT compact-
443
443
  * serialization string. Returns `{ ok, issues, refusal? }` per
@@ -697,7 +697,7 @@ var loadRulePack = _jwtRulePacks.load;
697
697
  * @since 0.7.49
698
698
  * @status stable
699
699
  * @compliance hipaa, pci-dss, gdpr, soc2
700
- * @related b.guardJwt.validate, b.auth.jwt.verifyExternal
700
+ * @related b.guardJwt.validate
701
701
  *
702
702
  * Throw on any `kid` value that contains path-traversal indicators
703
703
  * (`..`, `/`, `\`, percent-encoded variants) or non-printable
@@ -349,7 +349,7 @@ function _detectIssues(flow, opts) {
349
349
  * @since 0.7.49
350
350
  * @status stable
351
351
  * @compliance hipaa, pci-dss, gdpr, soc2
352
- * @related b.guardOauth.sanitize, b.guardOauth.gate, b.auth.oauth
352
+ * @related b.guardOauth.sanitize, b.guardOauth.gate
353
353
  *
354
354
  * Apply the full guard-oauth threat catalog to a flow bundle.
355
355
  * Returns `{ ok, issues, refusal? }` per
@@ -461,7 +461,7 @@ function sanitize(input, opts) {
461
461
  * @since 0.7.49
462
462
  * @status stable
463
463
  * @compliance hipaa, pci-dss, gdpr, soc2
464
- * @related b.guardOauth.validate, b.guardOauth.sanitize, b.auth.oauth
464
+ * @related b.guardOauth.validate, b.guardOauth.sanitize
465
465
  *
466
466
  * Build a `gateContract.buildGuardGate`-shaped gate that pulls
467
467
  * `ctx.oauthFlow` (or `ctx.flow`) and dispatches to `validate`.