@crvouga/mockingbird-service-payload-cms 3.10.5 → 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,11 @@
1
1
  # Changelog — @crvouga/mockingbird-service-payload-cms
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
+
3
9
  ## 3.10.5 (2026-11-02)
4
10
 
5
11
  ### Fixes and improvements
@@ -2355,6 +2355,17 @@ var createNamespaceControls = (options) => {
2355
2355
  };
2356
2356
  };
2357
2357
 
2358
+ // ../core/dist/signing.js
2359
+ var encoder = new TextEncoder();
2360
+ var timingSafeEqual = (a, b) => {
2361
+ if (a.length !== b.length)
2362
+ return false;
2363
+ let diff = 0;
2364
+ for (let i = 0; i < a.length; i++)
2365
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2366
+ return diff === 0;
2367
+ };
2368
+
2358
2369
  // ../core/dist/surface.js
2359
2370
  var defineMock = (runtime) => runtime;
2360
2371
  var ADMIN_ROUTE_REFERENCE = {
@@ -2473,6 +2484,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2473
2484
  }
2474
2485
  };
2475
2486
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2487
+ var hasAdminKey = (headers, adminKey) => {
2488
+ const sent = headers.get(ADMIN_KEY_HEADER);
2489
+ return sent !== null && timingSafeEqual(sent, adminKey);
2490
+ };
2476
2491
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2477
2492
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2478
2493
  var ADMIN_CONTROL_PAGES = [
@@ -2946,7 +2961,7 @@ var createControlPlane = (context) => {
2946
2961
  }
2947
2962
  const path = url.pathname.slice(adminPrefix.length) || "/";
2948
2963
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
2949
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
2964
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
2950
2965
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
2951
2966
  }
2952
2967
  for (const route of routes) {
@@ -3777,7 +3792,7 @@ var stateAdminRoutes = (routes) => {
3777
3792
  };
3778
3793
 
3779
3794
  // ../core/dist/version.js
3780
- var PACKAGE_VERSION = true ? "3.10.5" : UNRELEASED_VERSION;
3795
+ var PACKAGE_VERSION = true ? "3.10.6" : UNRELEASED_VERSION;
3781
3796
 
3782
3797
  // ../core/dist/webhooks.js
3783
3798
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -4758,7 +4773,7 @@ var createRuntime = (options) => {
4758
4773
  throw error;
4759
4774
  }
4760
4775
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
4761
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
4776
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
4762
4777
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
4763
4778
  controls.ensure(namespace);
4764
4779
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -5541,4 +5556,4 @@ export {
5541
5556
  compileWhere,
5542
5557
  PayloadCmsAPI
5543
5558
  };
5544
- //# sourceMappingURL=chunk-U2VRUXU3.js.map
5559
+ //# sourceMappingURL=chunk-2DDET23K.js.map