@crvouga/mockingbird-service-bedrock 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-bedrock
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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createRuntime,
3
3
  parseScript
4
- } from "./chunk-QWCGV7XU.js";
4
+ } from "./chunk-NLNC4UCO.js";
5
5
 
6
6
  // src/h2c.ts
7
7
  import {
@@ -338,4 +338,4 @@ export {
338
338
  createServer,
339
339
  serveTarget
340
340
  };
341
- //# sourceMappingURL=chunk-NP2OI2VN.js.map
341
+ //# sourceMappingURL=chunk-B3KY7DUX.js.map
@@ -2666,6 +2666,19 @@ var createNamespaceControls = (options) => {
2666
2666
  };
2667
2667
  };
2668
2668
 
2669
+ // ../core/dist/signing.js
2670
+ var encoder = new TextEncoder();
2671
+ var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
2672
+ var sha = async (algorithm, input) => toHex(await crypto.subtle.digest(algorithm, typeof input === "string" ? encoder.encode(input) : input));
2673
+ var timingSafeEqual = (a, b) => {
2674
+ if (a.length !== b.length)
2675
+ return false;
2676
+ let diff = 0;
2677
+ for (let i = 0; i < a.length; i++)
2678
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2679
+ return diff === 0;
2680
+ };
2681
+
2669
2682
  // ../core/dist/surface.js
2670
2683
  var defineMock = (runtime) => runtime;
2671
2684
  var ADMIN_ROUTE_REFERENCE = {
@@ -2784,6 +2797,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2784
2797
  }
2785
2798
  };
2786
2799
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2800
+ var hasAdminKey = (headers, adminKey) => {
2801
+ const sent = headers.get(ADMIN_KEY_HEADER);
2802
+ return sent !== null && timingSafeEqual(sent, adminKey);
2803
+ };
2787
2804
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2788
2805
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2789
2806
  var ADMIN_CONTROL_PAGES = [
@@ -3257,7 +3274,7 @@ var createControlPlane = (context) => {
3257
3274
  }
3258
3275
  const path = url.pathname.slice(adminPrefix.length) || "/";
3259
3276
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3260
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3277
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
3261
3278
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3262
3279
  }
3263
3280
  for (const route of routes) {
@@ -4048,12 +4065,7 @@ var stateAdminRoutes = (routes) => {
4048
4065
  };
4049
4066
 
4050
4067
  // ../core/dist/version.js
4051
- var PACKAGE_VERSION = true ? "3.10.5" : UNRELEASED_VERSION;
4052
-
4053
- // ../core/dist/signing.js
4054
- var encoder = new TextEncoder();
4055
- var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
4056
- var sha = async (algorithm, input) => toHex(await crypto.subtle.digest(algorithm, typeof input === "string" ? encoder.encode(input) : input));
4068
+ var PACKAGE_VERSION = true ? "3.10.6" : UNRELEASED_VERSION;
4057
4069
 
4058
4070
  // ../core/dist/webhooks.js
4059
4071
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -5034,7 +5046,7 @@ var createRuntime = (options) => {
5034
5046
  throw error;
5035
5047
  }
5036
5048
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5037
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5049
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5038
5050
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5039
5051
  controls.ensure(namespace);
5040
5052
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -7991,4 +8003,4 @@ export {
7991
8003
  lexicalEmbedding,
7992
8004
  BedrockAPI
7993
8005
  };
7994
- //# sourceMappingURL=chunk-QWCGV7XU.js.map
8006
+ //# sourceMappingURL=chunk-NLNC4UCO.js.map