@crvouga/mockingbird-service-wholescripts 3.10.2 → 3.10.3

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,11 @@
1
1
  # Changelog — @crvouga/mockingbird-service-wholescripts
2
2
 
3
+ ## 3.10.3 (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
+
3
9
  ## 3.10.2 (2026-11-02)
4
10
 
5
11
  ### Fixes and improvements
@@ -12,7 +12,7 @@ import {
12
12
  parseFaultHeader,
13
13
  resolveAdminPrefix,
14
14
  restoreClock
15
- } from "./chunk-BSDN2Z5D.js";
15
+ } from "./chunk-HMFAC443.js";
16
16
 
17
17
  // src/server.ts
18
18
  import { readFileSync } from "node:fs";
@@ -3063,7 +3063,7 @@ async function preflightFleet(config, options) {
3063
3063
  break;
3064
3064
  }
3065
3065
  }
3066
- targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.2" });
3066
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.3" });
3067
3067
  } catch (error) {
3068
3068
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3069
3069
  }
@@ -5096,4 +5096,4 @@ export {
5096
5096
  loadCatalogFile,
5097
5097
  serveTarget
5098
5098
  };
5099
- //# sourceMappingURL=chunk-XTO4MXSG.js.map
5099
+ //# sourceMappingURL=chunk-GZLHKLOK.js.map
@@ -2644,6 +2644,17 @@ var createNamespaceControls = (options) => {
2644
2644
  };
2645
2645
  };
2646
2646
 
2647
+ // ../core/dist/signing.js
2648
+ var encoder = new TextEncoder();
2649
+ var timingSafeEqual = (a, b) => {
2650
+ if (a.length !== b.length)
2651
+ return false;
2652
+ let diff = 0;
2653
+ for (let i = 0; i < a.length; i++)
2654
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2655
+ return diff === 0;
2656
+ };
2657
+
2647
2658
  // ../core/dist/surface.js
2648
2659
  var defineMock = (runtime) => runtime;
2649
2660
  var ADMIN_ROUTE_REFERENCE = {
@@ -2762,6 +2773,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2762
2773
  }
2763
2774
  };
2764
2775
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2776
+ var hasAdminKey = (headers, adminKey) => {
2777
+ const sent = headers.get(ADMIN_KEY_HEADER);
2778
+ return sent !== null && timingSafeEqual(sent, adminKey);
2779
+ };
2765
2780
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2766
2781
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2767
2782
  var ADMIN_CONTROL_PAGES = [
@@ -3235,7 +3250,7 @@ var createControlPlane = (context) => {
3235
3250
  }
3236
3251
  const path = url.pathname.slice(adminPrefix.length) || "/";
3237
3252
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3238
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3253
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
3239
3254
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3240
3255
  }
3241
3256
  for (const route of routes) {
@@ -4036,7 +4051,7 @@ var stateAdminRoutes = (routes) => {
4036
4051
  };
4037
4052
 
4038
4053
  // ../core/dist/version.js
4039
- var PACKAGE_VERSION = true ? "3.10.2" : UNRELEASED_VERSION;
4054
+ var PACKAGE_VERSION = true ? "3.10.3" : UNRELEASED_VERSION;
4040
4055
 
4041
4056
  // ../core/dist/webhooks.js
4042
4057
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -5017,7 +5032,7 @@ var createRuntime = (options) => {
5017
5032
  throw error;
5018
5033
  }
5019
5034
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5020
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5035
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5021
5036
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5022
5037
  controls.ensure(namespace);
5023
5038
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -6062,4 +6077,4 @@ export {
6062
6077
  canonicalStatus,
6063
6078
  WholescriptsAPI
6064
6079
  };
6065
- //# sourceMappingURL=chunk-BSDN2Z5D.js.map
6080
+ //# sourceMappingURL=chunk-HMFAC443.js.map