@crvouga/mockingbird-service-suunto 0.3.3 → 0.3.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-suunto
2
2
 
3
+ ## 0.3.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
  ## 0.3.3 (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-7YASH6AW.js";
12
+ } from "./chunk-UVECJPU7.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 ?? "0.3.3" });
3060
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "0.3.4" });
3061
3061
  } catch (error) {
3062
3062
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3063
3063
  }
@@ -5014,4 +5014,4 @@ export {
5014
5014
  createServer2 as createServer,
5015
5015
  serveTarget
5016
5016
  };
5017
- //# sourceMappingURL=chunk-37ASO4OF.js.map
5017
+ //# sourceMappingURL=chunk-IV6AZNTG.js.map
@@ -2401,6 +2401,24 @@ var createNamespaceControls = (options) => {
2401
2401
  };
2402
2402
  };
2403
2403
 
2404
+ // ../core/dist/signing.js
2405
+ var encoder = new TextEncoder();
2406
+ var toBase64 = (bytes) => {
2407
+ let binary = "";
2408
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
2409
+ binary += String.fromCharCode(byte);
2410
+ }
2411
+ return btoa(binary);
2412
+ };
2413
+ var timingSafeEqual = (a, b) => {
2414
+ if (a.length !== b.length)
2415
+ return false;
2416
+ let diff = 0;
2417
+ for (let i = 0; i < a.length; i++)
2418
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2419
+ return diff === 0;
2420
+ };
2421
+
2404
2422
  // ../core/dist/surface.js
2405
2423
  var defineMock = (runtime) => runtime;
2406
2424
  var ADMIN_ROUTE_REFERENCE = {
@@ -2519,6 +2537,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2519
2537
  }
2520
2538
  };
2521
2539
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2540
+ var hasAdminKey = (headers, adminKey) => {
2541
+ const sent = headers.get(ADMIN_KEY_HEADER);
2542
+ return sent !== null && timingSafeEqual(sent, adminKey);
2543
+ };
2522
2544
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2523
2545
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2524
2546
  var ADMIN_CONTROL_PAGES = [
@@ -2992,7 +3014,7 @@ var createControlPlane = (context) => {
2992
3014
  }
2993
3015
  const path = url.pathname.slice(adminPrefix.length) || "/";
2994
3016
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
2995
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3017
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
2996
3018
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
2997
3019
  }
2998
3020
  for (const route of routes) {
@@ -3771,17 +3793,7 @@ var stateAdminRoutes = (routes) => {
3771
3793
  };
3772
3794
 
3773
3795
  // ../core/dist/version.js
3774
- var PACKAGE_VERSION = true ? "0.3.3" : UNRELEASED_VERSION;
3775
-
3776
- // ../core/dist/signing.js
3777
- var encoder = new TextEncoder();
3778
- var toBase64 = (bytes) => {
3779
- let binary = "";
3780
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
3781
- binary += String.fromCharCode(byte);
3782
- }
3783
- return btoa(binary);
3784
- };
3796
+ var PACKAGE_VERSION = true ? "0.3.4" : UNRELEASED_VERSION;
3785
3797
 
3786
3798
  // ../core/dist/webhooks.js
3787
3799
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -4760,7 +4772,7 @@ var createRuntime = (options) => {
4760
4772
  throw error;
4761
4773
  }
4762
4774
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
4763
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
4775
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
4764
4776
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
4765
4777
  controls.ensure(namespace);
4766
4778
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -5714,4 +5726,4 @@ export {
5714
5726
  parseDate,
5715
5727
  SuuntoAPI
5716
5728
  };
5717
- //# sourceMappingURL=chunk-7YASH6AW.js.map
5729
+ //# sourceMappingURL=chunk-UVECJPU7.js.map