@crvouga/mockingbird-service-clerk 0.9.5 → 0.9.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-clerk
2
2
 
3
+ ## 0.9.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
  ## 0.9.5 (2026-11-02)
4
10
 
5
11
  ### Fixes and improvements
@@ -2476,6 +2476,17 @@ var createNamespaceControls = (options) => {
2476
2476
  };
2477
2477
  };
2478
2478
 
2479
+ // ../core/dist/signing.js
2480
+ var encoder = new TextEncoder();
2481
+ var timingSafeEqual2 = (a, b) => {
2482
+ if (a.length !== b.length)
2483
+ return false;
2484
+ let diff = 0;
2485
+ for (let i = 0; i < a.length; i++)
2486
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2487
+ return diff === 0;
2488
+ };
2489
+
2479
2490
  // ../core/dist/surface.js
2480
2491
  var defineMock = (runtime) => runtime;
2481
2492
  var ADMIN_ROUTE_REFERENCE = {
@@ -2594,6 +2605,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2594
2605
  }
2595
2606
  };
2596
2607
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2608
+ var hasAdminKey = (headers, adminKey) => {
2609
+ const sent = headers.get(ADMIN_KEY_HEADER);
2610
+ return sent !== null && timingSafeEqual2(sent, adminKey);
2611
+ };
2597
2612
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2598
2613
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2599
2614
  var ADMIN_CONTROL_PAGES = [
@@ -3067,7 +3082,7 @@ var createControlPlane = (context) => {
3067
3082
  }
3068
3083
  const path = url.pathname.slice(adminPrefix.length) || "/";
3069
3084
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3070
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3085
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
3071
3086
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3072
3087
  }
3073
3088
  for (const route of routes) {
@@ -3822,7 +3837,7 @@ var stateAdminRoutes = (routes) => {
3822
3837
  };
3823
3838
 
3824
3839
  // ../core/dist/version.js
3825
- var PACKAGE_VERSION = true ? "0.9.5" : UNRELEASED_VERSION;
3840
+ var PACKAGE_VERSION = true ? "0.9.6" : UNRELEASED_VERSION;
3826
3841
 
3827
3842
  // ../core/dist/webhooks.js
3828
3843
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -4801,7 +4816,7 @@ var createRuntime = (options) => {
4801
4816
  throw error;
4802
4817
  }
4803
4818
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
4804
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
4819
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
4805
4820
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
4806
4821
  controls.ensure(namespace);
4807
4822
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -8105,4 +8120,4 @@ export {
8105
8120
  * Copyright (c) 2021 - present, Yusuke Wada and Hono contributors
8106
8121
  * MIT license: see THIRD_PARTY_NOTICES.md in the repository and npm packages.
8107
8122
  */
8108
- //# sourceMappingURL=chunk-TCX6K3HS.js.map
8123
+ //# sourceMappingURL=chunk-5SO3WRBX.js.map