@crvouga/mockingbird-service-formbricks 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-formbricks
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
@@ -11,7 +11,7 @@ import {
11
11
  parseFaultHeader,
12
12
  resolveAdminPrefix,
13
13
  restoreClock
14
- } from "./chunk-2OK7KDJS.js";
14
+ } from "./chunk-SX5N45LI.js";
15
15
 
16
16
  // src/server.ts
17
17
  import { readFileSync } from "node:fs";
@@ -3062,7 +3062,7 @@ async function preflightFleet(config, options) {
3062
3062
  break;
3063
3063
  }
3064
3064
  }
3065
- targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.4" });
3065
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.6" });
3066
3066
  } catch (error) {
3067
3067
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3068
3068
  }
@@ -5175,4 +5175,4 @@ export {
5175
5175
  loadSurveysFile,
5176
5176
  serveTarget
5177
5177
  };
5178
- //# sourceMappingURL=chunk-23LBR4RJ.js.map
5178
+ //# sourceMappingURL=chunk-7Y7ZTDBE.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));
@@ -2391,6 +2401,46 @@ var createNamespaceControls = (options) => {
2391
2401
  };
2392
2402
  };
2393
2403
 
2404
+ // ../core/dist/signing.js
2405
+ var encoder = new TextEncoder();
2406
+ var toBase64 = (bytes) => {
2407
+ let binary = "";
2408
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
2409
+ binary += String.fromCharCode(byte);
2410
+ }
2411
+ return btoa(binary);
2412
+ };
2413
+ var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
2414
+ var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
2415
+ var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
2416
+ var hmac = async (algorithm, key, message, encoding = "hex") => {
2417
+ const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
2418
+ const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
2419
+ return encoding === "hex" ? toHex(signed) : toBase64(signed);
2420
+ };
2421
+ var svixSecretBytes = (secret) => {
2422
+ const raw = secret.replace(/^f?whsec_/, "");
2423
+ try {
2424
+ return fromBase64(raw);
2425
+ } catch {
2426
+ throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
2427
+ }
2428
+ };
2429
+ var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
2430
+ var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
2431
+ var signTwilio = async (authToken, url, params) => {
2432
+ const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
2433
+ return hmac("SHA-1", authToken, payload, "base64");
2434
+ };
2435
+ var timingSafeEqual = (a, b) => {
2436
+ if (a.length !== b.length)
2437
+ return false;
2438
+ let diff = 0;
2439
+ for (let i = 0; i < a.length; i++)
2440
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2441
+ return diff === 0;
2442
+ };
2443
+
2394
2444
  // ../core/dist/surface.js
2395
2445
  var defineMock = (runtime) => runtime;
2396
2446
  var ADMIN_ROUTE_REFERENCE = {
@@ -2509,6 +2559,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2509
2559
  }
2510
2560
  };
2511
2561
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2562
+ var hasAdminKey = (headers, adminKey) => {
2563
+ const sent = headers.get(ADMIN_KEY_HEADER);
2564
+ return sent !== null && timingSafeEqual(sent, adminKey);
2565
+ };
2512
2566
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2513
2567
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2514
2568
  var ADMIN_CONTROL_PAGES = [
@@ -2982,7 +3036,7 @@ var createControlPlane = (context) => {
2982
3036
  }
2983
3037
  const path = url.pathname.slice(adminPrefix.length) || "/";
2984
3038
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
2985
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3039
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
2986
3040
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
2987
3041
  }
2988
3042
  for (const route of routes) {
@@ -3765,39 +3819,7 @@ var stateAdminRoutes = (routes) => {
3765
3819
  };
3766
3820
 
3767
3821
  // ../core/dist/version.js
3768
- var PACKAGE_VERSION = true ? "3.10.4" : UNRELEASED_VERSION;
3769
-
3770
- // ../core/dist/signing.js
3771
- var encoder = new TextEncoder();
3772
- var toBase64 = (bytes) => {
3773
- let binary = "";
3774
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
3775
- binary += String.fromCharCode(byte);
3776
- }
3777
- return btoa(binary);
3778
- };
3779
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
3780
- var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
3781
- var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
3782
- var hmac = async (algorithm, key, message, encoding = "hex") => {
3783
- const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
3784
- const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
3785
- return encoding === "hex" ? toHex(signed) : toBase64(signed);
3786
- };
3787
- var svixSecretBytes = (secret) => {
3788
- const raw = secret.replace(/^f?whsec_/, "");
3789
- try {
3790
- return fromBase64(raw);
3791
- } catch {
3792
- throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
3793
- }
3794
- };
3795
- var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
3796
- var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
3797
- var signTwilio = async (authToken, url, params) => {
3798
- const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
3799
- return hmac("SHA-1", authToken, payload, "base64");
3800
- };
3822
+ var PACKAGE_VERSION = true ? "3.10.6" : UNRELEASED_VERSION;
3801
3823
 
3802
3824
  // ../core/dist/webhooks.js
3803
3825
  var signers = {
@@ -5194,7 +5216,7 @@ var createRuntime = (options) => {
5194
5216
  throw error2;
5195
5217
  }
5196
5218
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5197
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5219
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5198
5220
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5199
5221
  controls.ensure(namespace);
5200
5222
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -7254,4 +7276,4 @@ export {
7254
7276
  formbricksError,
7255
7277
  FormbricksAPI
7256
7278
  };
7257
- //# sourceMappingURL=chunk-2OK7KDJS.js.map
7279
+ //# sourceMappingURL=chunk-SX5N45LI.js.map