@crvouga/mockingbird-service-aha 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,18 @@
1
1
  # Changelog — @crvouga/mockingbird-service-aha
2
2
 
3
+ ## 3.10.6 (2026-11-02)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - compare the admin key in constant time ([2a43141](https://github.com/crvouga/mockingbird/commit/2a43141f50dab41e698c3bbce0c69bf65b40e24e))
8
+
9
+ ## 3.10.5 (2026-11-02)
10
+
11
+ ### Fixes and improvements
12
+
13
+ - stop walkSchema recursing forever on a self-referential $ref ([69464a9](https://github.com/crvouga/mockingbird/commit/69464a9d9e7f468c5e1095125108d4d3d5515431))
14
+ - densify sparse bracket arrays by their written indices ([84a28cb](https://github.com/crvouga/mockingbird/commit/84a28cb182e3d7df91102897f0fc11fca714ba5f))
15
+
3
16
  ## 3.10.4 (2026-11-02)
4
17
 
5
18
  ### Fixes and improvements
@@ -9,7 +9,7 @@ import {
9
9
  parseFaultHeader,
10
10
  resolveAdminPrefix,
11
11
  restoreClock
12
- } from "./chunk-KO36APMJ.js";
12
+ } from "./chunk-QICZZMWD.js";
13
13
 
14
14
  // ../../adapters/node/dist/cli.js
15
15
  import { readFile as readFile5 } from "node:fs/promises";
@@ -3057,7 +3057,7 @@ async function preflightFleet(config, options) {
3057
3057
  break;
3058
3058
  }
3059
3059
  }
3060
- targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.4" });
3060
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.6" });
3061
3061
  } catch (error) {
3062
3062
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3063
3063
  }
@@ -5080,4 +5080,4 @@ export {
5080
5080
  createServer2 as createServer,
5081
5081
  serveTarget
5082
5082
  };
5083
- //# sourceMappingURL=chunk-F74PD2VS.js.map
5083
+ //# sourceMappingURL=chunk-BZNYGTNJ.js.map
@@ -495,6 +495,7 @@ var parsePath = (rawKey) => {
495
495
  return path;
496
496
  };
497
497
  var isIndex = (segment) => /^(0|[1-9][0-9]*)$/.test(segment);
498
+ var MAX_ARRAY_INDEX = 4294967294;
498
499
  var put = (target, key2, value) => {
499
500
  if (key2 === "__proto__") {
500
501
  Object.defineProperty(target, key2, {
@@ -557,8 +558,17 @@ var decodeFormPairs = (pairs) => {
557
558
  var densify = (value) => {
558
559
  if (typeof value === "string")
559
560
  return value;
560
- if (Array.isArray(value))
561
- return value.filter((item) => item !== void 0).map(densify);
561
+ if (Array.isArray(value)) {
562
+ const dense = [];
563
+ for (const key2 of Object.keys(value)) {
564
+ if (!isIndex(key2) || Number(key2) > MAX_ARRAY_INDEX)
565
+ continue;
566
+ const item = value[Number(key2)];
567
+ if (item !== void 0)
568
+ dense.push(densify(item));
569
+ }
570
+ return dense;
571
+ }
562
572
  const out = {};
563
573
  for (const [key2, item] of Object.entries(value))
564
574
  put(out, key2, densify(item));
@@ -2666,6 +2676,46 @@ var createNamespaceControls = (options) => {
2666
2676
  };
2667
2677
  };
2668
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 = (key2) => typeof key2 === "string" ? encoder.encode(key2) : key2;
2691
+ var hmac = async (algorithm, key2, message, encoding = "hex") => {
2692
+ const imported = await crypto.subtle.importKey("raw", keyBytes(key2), { 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((key2) => `${key2}${params[key2]}`).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
+
2669
2719
  // ../core/dist/surface.js
2670
2720
  var defineMock = (runtime) => runtime;
2671
2721
  var ADMIN_ROUTE_REFERENCE = {
@@ -2784,6 +2834,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2784
2834
  }
2785
2835
  };
2786
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
+ };
2787
2841
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2788
2842
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2789
2843
  var ADMIN_CONTROL_PAGES = [
@@ -3257,7 +3311,7 @@ var createControlPlane = (context) => {
3257
3311
  }
3258
3312
  const path = url.pathname.slice(adminPrefix.length) || "/";
3259
3313
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3260
- 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)) {
3261
3315
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3262
3316
  }
3263
3317
  for (const route of routes) {
@@ -4101,47 +4155,7 @@ var stateAdminRoutes = (routes) => {
4101
4155
  };
4102
4156
 
4103
4157
  // ../core/dist/version.js
4104
- var PACKAGE_VERSION = true ? "3.10.4" : UNRELEASED_VERSION;
4105
-
4106
- // ../core/dist/signing.js
4107
- var encoder = new TextEncoder();
4108
- var toBase64 = (bytes) => {
4109
- let binary = "";
4110
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
4111
- binary += String.fromCharCode(byte);
4112
- }
4113
- return btoa(binary);
4114
- };
4115
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
4116
- var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
4117
- var keyBytes = (key2) => typeof key2 === "string" ? encoder.encode(key2) : key2;
4118
- var hmac = async (algorithm, key2, message, encoding = "hex") => {
4119
- const imported = await crypto.subtle.importKey("raw", keyBytes(key2), { name: "HMAC", hash: algorithm }, false, ["sign"]);
4120
- const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
4121
- return encoding === "hex" ? toHex(signed) : toBase64(signed);
4122
- };
4123
- var svixSecretBytes = (secret) => {
4124
- const raw = secret.replace(/^f?whsec_/, "");
4125
- try {
4126
- return fromBase64(raw);
4127
- } catch {
4128
- throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
4129
- }
4130
- };
4131
- var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
4132
- var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
4133
- var signTwilio = async (authToken, url, params) => {
4134
- const payload = url + Object.keys(params).sort().map((key2) => `${key2}${params[key2]}`).join("");
4135
- return hmac("SHA-1", authToken, payload, "base64");
4136
- };
4137
- var timingSafeEqual = (a, b) => {
4138
- if (a.length !== b.length)
4139
- return false;
4140
- let diff = 0;
4141
- for (let i = 0; i < a.length; i++)
4142
- diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
4143
- return diff === 0;
4144
- };
4158
+ var PACKAGE_VERSION = true ? "3.10.6" : UNRELEASED_VERSION;
4145
4159
 
4146
4160
  // ../core/dist/webhooks.js
4147
4161
  var signers = {
@@ -5538,7 +5552,7 @@ var createRuntime = (options) => {
5538
5552
  throw error2;
5539
5553
  }
5540
5554
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5541
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5555
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5542
5556
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5543
5557
  controls.ensure(namespace);
5544
5558
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -6534,4 +6548,4 @@ export {
6534
6548
  apiKeyCredential,
6535
6549
  AhaAPI
6536
6550
  };
6537
- //# sourceMappingURL=chunk-KO36APMJ.js.map
6551
+ //# sourceMappingURL=chunk-QICZZMWD.js.map