@crvouga/mockingbird-service-rxvortex 3.10.4 → 3.10.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
@@ -1,5 +1,17 @@
1
1
  # Changelog — @crvouga/mockingbird-service-rxvortex
2
2
 
3
+ ## 3.10.6 (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.5 (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.4 (2026-11-02)
4
16
 
5
17
  ### Fixes and improvements
@@ -2676,6 +2676,46 @@ var createNamespaceControls = (options) => {
2676
2676
  };
2677
2677
  };
2678
2678
 
2679
+ // ../core/dist/signing.js
2680
+ var encoder = new TextEncoder();
2681
+ var toBase64 = (bytes) => {
2682
+ let binary = "";
2683
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
2684
+ binary += String.fromCharCode(byte);
2685
+ }
2686
+ return btoa(binary);
2687
+ };
2688
+ var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
2689
+ var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
2690
+ var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
2691
+ var hmac = async (algorithm, key, message, encoding = "hex") => {
2692
+ const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
2693
+ const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
2694
+ return encoding === "hex" ? toHex(signed) : toBase64(signed);
2695
+ };
2696
+ var svixSecretBytes = (secret) => {
2697
+ const raw = secret.replace(/^f?whsec_/, "");
2698
+ try {
2699
+ return fromBase64(raw);
2700
+ } catch {
2701
+ throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
2702
+ }
2703
+ };
2704
+ var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
2705
+ var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
2706
+ var signTwilio = async (authToken, url, params) => {
2707
+ const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
2708
+ return hmac("SHA-1", authToken, payload, "base64");
2709
+ };
2710
+ var timingSafeEqual = (a, b) => {
2711
+ if (a.length !== b.length)
2712
+ return false;
2713
+ let diff = 0;
2714
+ for (let i = 0; i < a.length; i++)
2715
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2716
+ return diff === 0;
2717
+ };
2718
+
2679
2719
  // ../core/dist/surface.js
2680
2720
  var defineMock = (runtime) => runtime;
2681
2721
  var ADMIN_ROUTE_REFERENCE = {
@@ -2794,6 +2834,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2794
2834
  }
2795
2835
  };
2796
2836
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2837
+ var hasAdminKey = (headers, adminKey) => {
2838
+ const sent = headers.get(ADMIN_KEY_HEADER);
2839
+ return sent !== null && timingSafeEqual(sent, adminKey);
2840
+ };
2797
2841
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2798
2842
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2799
2843
  var ADMIN_CONTROL_PAGES = [
@@ -3267,7 +3311,7 @@ var createControlPlane = (context) => {
3267
3311
  }
3268
3312
  const path = url.pathname.slice(adminPrefix.length) || "/";
3269
3313
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3270
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3314
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
3271
3315
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3272
3316
  }
3273
3317
  for (const route of routes) {
@@ -4057,39 +4101,7 @@ var stateAdminRoutes = (routes) => {
4057
4101
  };
4058
4102
 
4059
4103
  // ../core/dist/version.js
4060
- var PACKAGE_VERSION = true ? "3.10.4" : UNRELEASED_VERSION;
4061
-
4062
- // ../core/dist/signing.js
4063
- var encoder = new TextEncoder();
4064
- var toBase64 = (bytes) => {
4065
- let binary = "";
4066
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
4067
- binary += String.fromCharCode(byte);
4068
- }
4069
- return btoa(binary);
4070
- };
4071
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
4072
- var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
4073
- var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
4074
- var hmac = async (algorithm, key, message, encoding = "hex") => {
4075
- const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
4076
- const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
4077
- return encoding === "hex" ? toHex(signed) : toBase64(signed);
4078
- };
4079
- var svixSecretBytes = (secret) => {
4080
- const raw = secret.replace(/^f?whsec_/, "");
4081
- try {
4082
- return fromBase64(raw);
4083
- } catch {
4084
- throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
4085
- }
4086
- };
4087
- var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
4088
- var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
4089
- var signTwilio = async (authToken, url, params) => {
4090
- const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
4091
- return hmac("SHA-1", authToken, payload, "base64");
4092
- };
4104
+ var PACKAGE_VERSION = true ? "3.10.6" : UNRELEASED_VERSION;
4093
4105
 
4094
4106
  // ../core/dist/webhooks.js
4095
4107
  var signers = {
@@ -5486,7 +5498,7 @@ var createRuntime = (options) => {
5486
5498
  throw error;
5487
5499
  }
5488
5500
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5489
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5501
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5490
5502
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5491
5503
  controls.ensure(namespace);
5492
5504
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -6593,4 +6605,4 @@ export {
6593
6605
  tokenCredential,
6594
6606
  RxVortexAPI
6595
6607
  };
6596
- //# sourceMappingURL=chunk-WTEH3P6P.js.map
6608
+ //# sourceMappingURL=chunk-I7G6R45H.js.map