@crvouga/mockingbird-service-paddle 2.11.4 → 2.11.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-paddle
2
2
 
3
+ ## 2.11.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
+ ## 2.11.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
  ## 2.11.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-CJ74QHON.js";
12
+ } from "./chunk-B5NQNTDL.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 ?? "2.11.4" });
3060
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "2.11.6" });
3061
3061
  } catch (error) {
3062
3062
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3063
3063
  }
@@ -5051,4 +5051,4 @@ export {
5051
5051
  createServer2 as createServer,
5052
5052
  serveTarget
5053
5053
  };
5054
- //# sourceMappingURL=chunk-IKSTW6MY.js.map
5054
+ //# sourceMappingURL=chunk-5WJOIJCX.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, key, value) => {
499
500
  if (key === "__proto__") {
500
501
  Object.defineProperty(target, key, {
@@ -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 key of Object.keys(value)) {
564
+ if (!isIndex(key) || Number(key) > MAX_ARRAY_INDEX)
565
+ continue;
566
+ const item = value[Number(key)];
567
+ if (item !== void 0)
568
+ dense.push(densify(item));
569
+ }
570
+ return dense;
571
+ }
562
572
  const out = {};
563
573
  for (const [key, item] of Object.entries(value))
564
574
  put(out, key, densify(item));
@@ -2656,6 +2666,46 @@ var createNamespaceControls = (options) => {
2656
2666
  };
2657
2667
  };
2658
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
+
2659
2709
  // ../core/dist/surface.js
2660
2710
  var defineMock = (runtime) => runtime;
2661
2711
  var ADMIN_ROUTE_REFERENCE = {
@@ -2774,6 +2824,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2774
2824
  }
2775
2825
  };
2776
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
+ };
2777
2831
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2778
2832
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2779
2833
  var ADMIN_CONTROL_PAGES = [
@@ -3247,7 +3301,7 @@ var createControlPlane = (context) => {
3247
3301
  }
3248
3302
  const path = url.pathname.slice(adminPrefix.length) || "/";
3249
3303
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3250
- 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)) {
3251
3305
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3252
3306
  }
3253
3307
  for (const route of routes) {
@@ -4015,39 +4069,7 @@ var stateAdminRoutes = (routes) => {
4015
4069
  };
4016
4070
 
4017
4071
  // ../core/dist/version.js
4018
- var PACKAGE_VERSION = true ? "2.11.4" : UNRELEASED_VERSION;
4019
-
4020
- // ../core/dist/signing.js
4021
- var encoder = new TextEncoder();
4022
- var toBase64 = (bytes) => {
4023
- let binary = "";
4024
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
4025
- binary += String.fromCharCode(byte);
4026
- }
4027
- return btoa(binary);
4028
- };
4029
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
4030
- var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
4031
- var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
4032
- var hmac = async (algorithm, key, message, encoding = "hex") => {
4033
- const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
4034
- const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
4035
- return encoding === "hex" ? toHex(signed) : toBase64(signed);
4036
- };
4037
- var svixSecretBytes = (secret) => {
4038
- const raw = secret.replace(/^f?whsec_/, "");
4039
- try {
4040
- return fromBase64(raw);
4041
- } catch {
4042
- throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
4043
- }
4044
- };
4045
- var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
4046
- var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
4047
- var signTwilio = async (authToken, url, params) => {
4048
- const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
4049
- return hmac("SHA-1", authToken, payload, "base64");
4050
- };
4072
+ var PACKAGE_VERSION = true ? "2.11.6" : UNRELEASED_VERSION;
4051
4073
 
4052
4074
  // ../core/dist/webhooks.js
4053
4075
  var signers = {
@@ -5442,7 +5464,7 @@ var createRuntime = (options) => {
5442
5464
  throw error;
5443
5465
  }
5444
5466
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5445
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5467
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5446
5468
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5447
5469
  controls.ensure(namespace);
5448
5470
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -8613,4 +8635,4 @@ export {
8613
8635
  AUTH_TOKEN_TTL_MS,
8614
8636
  PaddleAPI
8615
8637
  };
8616
- //# sourceMappingURL=chunk-CJ74QHON.js.map
8638
+ //# sourceMappingURL=chunk-B5NQNTDL.js.map