@crvouga/mockingbird-service-daily 3.10.5 → 3.10.7

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
@@ -1,5 +1,17 @@
1
1
  # Changelog — @crvouga/mockingbird-service-daily
2
2
 
3
+ ## 3.10.7 (2026-11-02)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - save and replay a 500 the endpoint produced under an Idempotency-Key ([789bbcc](https://github.com/crvouga/mockingbird/commit/789bbcccb792cddaf27f4f6db6d2fcf2da1d07fe))
8
+
9
+ ## 3.10.6 (2026-11-02)
10
+
11
+ ### Fixes and improvements
12
+
13
+ - compare the admin key in constant time ([2a43141](https://github.com/crvouga/mockingbird/commit/2a43141f50dab41e698c3bbce0c69bf65b40e24e))
14
+
3
15
  ## 3.10.5 (2026-11-02)
4
16
 
5
17
  ### Fixes and improvements
@@ -2666,6 +2666,46 @@ var createNamespaceControls = (options) => {
2666
2666
  };
2667
2667
  };
2668
2668
 
2669
+ // ../core/dist/signing.js
2670
+ var encoder = new TextEncoder();
2671
+ var toBase64 = (bytes) => {
2672
+ let binary = "";
2673
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
2674
+ binary += String.fromCharCode(byte);
2675
+ }
2676
+ return btoa(binary);
2677
+ };
2678
+ var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
2679
+ var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
2680
+ var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
2681
+ var hmac = async (algorithm, key, message, encoding = "hex") => {
2682
+ const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
2683
+ const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
2684
+ return encoding === "hex" ? toHex(signed) : toBase64(signed);
2685
+ };
2686
+ var svixSecretBytes = (secret) => {
2687
+ const raw = secret.replace(/^f?whsec_/, "");
2688
+ try {
2689
+ return fromBase64(raw);
2690
+ } catch {
2691
+ throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
2692
+ }
2693
+ };
2694
+ var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
2695
+ var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
2696
+ var signTwilio = async (authToken, url, params) => {
2697
+ const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
2698
+ return hmac("SHA-1", authToken, payload, "base64");
2699
+ };
2700
+ var timingSafeEqual = (a, b) => {
2701
+ if (a.length !== b.length)
2702
+ return false;
2703
+ let diff = 0;
2704
+ for (let i = 0; i < a.length; i++)
2705
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2706
+ return diff === 0;
2707
+ };
2708
+
2669
2709
  // ../core/dist/surface.js
2670
2710
  var defineMock = (runtime) => runtime;
2671
2711
  var ADMIN_ROUTE_REFERENCE = {
@@ -2784,6 +2824,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2784
2824
  }
2785
2825
  };
2786
2826
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2827
+ var hasAdminKey = (headers, adminKey) => {
2828
+ const sent = headers.get(ADMIN_KEY_HEADER);
2829
+ return sent !== null && timingSafeEqual(sent, adminKey);
2830
+ };
2787
2831
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2788
2832
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2789
2833
  var ADMIN_CONTROL_PAGES = [
@@ -3257,7 +3301,7 @@ var createControlPlane = (context) => {
3257
3301
  }
3258
3302
  const path = url.pathname.slice(adminPrefix.length) || "/";
3259
3303
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3260
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3304
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
3261
3305
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3262
3306
  }
3263
3307
  for (const route of routes) {
@@ -4047,47 +4091,7 @@ var stateAdminRoutes = (routes) => {
4047
4091
  };
4048
4092
 
4049
4093
  // ../core/dist/version.js
4050
- var PACKAGE_VERSION = true ? "3.10.5" : UNRELEASED_VERSION;
4051
-
4052
- // ../core/dist/signing.js
4053
- var encoder = new TextEncoder();
4054
- var toBase64 = (bytes) => {
4055
- let binary = "";
4056
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
4057
- binary += String.fromCharCode(byte);
4058
- }
4059
- return btoa(binary);
4060
- };
4061
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
4062
- var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
4063
- var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
4064
- var hmac = async (algorithm, key, message, encoding = "hex") => {
4065
- const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
4066
- const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
4067
- return encoding === "hex" ? toHex(signed) : toBase64(signed);
4068
- };
4069
- var svixSecretBytes = (secret) => {
4070
- const raw = secret.replace(/^f?whsec_/, "");
4071
- try {
4072
- return fromBase64(raw);
4073
- } catch {
4074
- throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
4075
- }
4076
- };
4077
- var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
4078
- var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
4079
- var signTwilio = async (authToken, url, params) => {
4080
- const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
4081
- return hmac("SHA-1", authToken, payload, "base64");
4082
- };
4083
- var timingSafeEqual = (a, b) => {
4084
- if (a.length !== b.length)
4085
- return false;
4086
- let diff = 0;
4087
- for (let i = 0; i < a.length; i++)
4088
- diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
4089
- return diff === 0;
4090
- };
4094
+ var PACKAGE_VERSION = true ? "3.10.7" : UNRELEASED_VERSION;
4091
4095
 
4092
4096
  // ../core/dist/webhooks.js
4093
4097
  var signers = {
@@ -5484,7 +5488,7 @@ var createRuntime = (options) => {
5484
5488
  throw error;
5485
5489
  }
5486
5490
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5487
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5491
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5488
5492
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5489
5493
  controls.ensure(namespace);
5490
5494
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -6655,4 +6659,4 @@ export {
6655
6659
  DailyAPI,
6656
6660
  synthesizeTranscript
6657
6661
  };
6658
- //# sourceMappingURL=chunk-SYOOY6LL.js.map
6662
+ //# sourceMappingURL=chunk-366M52YG.js.map