@crvouga/mockingbird-service-caretalk 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-caretalk
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
@@ -9,7 +9,7 @@ import {
9
9
  parseFaultHeader,
10
10
  resolveAdminPrefix,
11
11
  restoreClock
12
- } from "./chunk-2YEWPWDV.js";
12
+ } from "./chunk-M6IKDJGU.js";
13
13
 
14
14
  // ../../adapters/node/dist/cli.js
15
15
  import { readFile as readFile5 } from "node:fs/promises";
@@ -3057,7 +3057,7 @@ async function preflightFleet(config, options) {
3057
3057
  break;
3058
3058
  }
3059
3059
  }
3060
- targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.5" });
3060
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.6" });
3061
3061
  } catch (error) {
3062
3062
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3063
3063
  }
@@ -5039,4 +5039,4 @@ export {
5039
5039
  createServer2 as createServer,
5040
5040
  serveTarget
5041
5041
  };
5042
- //# sourceMappingURL=chunk-O3NL3LDR.js.map
5042
+ //# sourceMappingURL=chunk-INYNJMH3.js.map
@@ -2654,6 +2654,25 @@ var createNamespaceControls = (options) => {
2654
2654
  };
2655
2655
  };
2656
2656
 
2657
+ // ../core/dist/signing.js
2658
+ var encoder = new TextEncoder();
2659
+ var toBase64 = (bytes) => {
2660
+ let binary = "";
2661
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
2662
+ binary += String.fromCharCode(byte);
2663
+ }
2664
+ return btoa(binary);
2665
+ };
2666
+ var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
2667
+ var timingSafeEqual = (a, b) => {
2668
+ if (a.length !== b.length)
2669
+ return false;
2670
+ let diff = 0;
2671
+ for (let i = 0; i < a.length; i++)
2672
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2673
+ return diff === 0;
2674
+ };
2675
+
2657
2676
  // ../core/dist/surface.js
2658
2677
  var defineMock = (runtime) => runtime;
2659
2678
  var ADMIN_ROUTE_REFERENCE = {
@@ -2772,6 +2791,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2772
2791
  }
2773
2792
  };
2774
2793
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2794
+ var hasAdminKey = (headers, adminKey) => {
2795
+ const sent = headers.get(ADMIN_KEY_HEADER);
2796
+ return sent !== null && timingSafeEqual(sent, adminKey);
2797
+ };
2775
2798
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2776
2799
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2777
2800
  var ADMIN_CONTROL_PAGES = [
@@ -3245,7 +3268,7 @@ var createControlPlane = (context) => {
3245
3268
  }
3246
3269
  const path = url.pathname.slice(adminPrefix.length) || "/";
3247
3270
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3248
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3271
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
3249
3272
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3250
3273
  }
3251
3274
  for (const route of routes) {
@@ -4035,18 +4058,7 @@ var stateAdminRoutes = (routes) => {
4035
4058
  };
4036
4059
 
4037
4060
  // ../core/dist/version.js
4038
- var PACKAGE_VERSION = true ? "3.10.5" : UNRELEASED_VERSION;
4039
-
4040
- // ../core/dist/signing.js
4041
- var encoder = new TextEncoder();
4042
- var toBase64 = (bytes) => {
4043
- let binary = "";
4044
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
4045
- binary += String.fromCharCode(byte);
4046
- }
4047
- return btoa(binary);
4048
- };
4049
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
4061
+ var PACKAGE_VERSION = true ? "3.10.6" : UNRELEASED_VERSION;
4050
4062
 
4051
4063
  // ../core/dist/webhooks.js
4052
4064
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -5027,7 +5039,7 @@ var createRuntime = (options) => {
5027
5039
  throw error;
5028
5040
  }
5029
5041
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5030
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5042
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5031
5043
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5032
5044
  controls.ensure(namespace);
5033
5045
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -6208,4 +6220,4 @@ export {
6208
6220
  normalizeDate,
6209
6221
  CareTalkAPI
6210
6222
  };
6211
- //# sourceMappingURL=chunk-2YEWPWDV.js.map
6223
+ //# sourceMappingURL=chunk-M6IKDJGU.js.map