@crvouga/mockingbird-service-sts 1.9.3 → 1.9.4

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-sts
2
2
 
3
+ ## 1.9.4 (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
  ## 1.9.3 (2026-11-02)
4
10
 
5
11
  ### Fixes and improvements
@@ -6796,6 +6796,17 @@ var createNamespaceControls = (options) => {
6796
6796
  };
6797
6797
  };
6798
6798
 
6799
+ // ../core/dist/signing.js
6800
+ var encoder = new TextEncoder();
6801
+ var timingSafeEqual = (a, b) => {
6802
+ if (a.length !== b.length)
6803
+ return false;
6804
+ let diff = 0;
6805
+ for (let i = 0; i < a.length; i++)
6806
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
6807
+ return diff === 0;
6808
+ };
6809
+
6799
6810
  // ../core/dist/surface.js
6800
6811
  var defineMock = (runtime) => runtime;
6801
6812
  var ADMIN_ROUTE_REFERENCE = {
@@ -6914,6 +6925,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
6914
6925
  }
6915
6926
  };
6916
6927
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
6928
+ var hasAdminKey = (headers, adminKey) => {
6929
+ const sent = headers.get(ADMIN_KEY_HEADER);
6930
+ return sent !== null && timingSafeEqual(sent, adminKey);
6931
+ };
6917
6932
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
6918
6933
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
6919
6934
  var ADMIN_CONTROL_PAGES = [
@@ -7387,7 +7402,7 @@ var createControlPlane = (context) => {
7387
7402
  }
7388
7403
  const path = url.pathname.slice(adminPrefix.length) || "/";
7389
7404
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
7390
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
7405
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
7391
7406
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
7392
7407
  }
7393
7408
  for (const route of routes) {
@@ -8150,7 +8165,7 @@ var stateAdminRoutes = (routes) => {
8150
8165
  };
8151
8166
 
8152
8167
  // ../core/dist/version.js
8153
- var PACKAGE_VERSION = true ? "1.9.3" : UNRELEASED_VERSION;
8168
+ var PACKAGE_VERSION = true ? "1.9.4" : UNRELEASED_VERSION;
8154
8169
 
8155
8170
  // ../core/dist/webhooks.js
8156
8171
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -9129,7 +9144,7 @@ var createRuntime = (options) => {
9129
9144
  throw error;
9130
9145
  }
9131
9146
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
9132
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
9147
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
9133
9148
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
9134
9149
  controls.ensure(namespace);
9135
9150
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -9524,4 +9539,4 @@ export {
9524
9539
  createRuntime2 as createRuntime,
9525
9540
  StsAPI
9526
9541
  };
9527
- //# sourceMappingURL=chunk-YIV2LXX3.js.map
9542
+ //# sourceMappingURL=chunk-3OUF7KYR.js.map