@crvouga/mockingbird-service-google-maps 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-google-maps
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
@@ -2379,6 +2379,25 @@ var createNamespaceControls = (options) => {
2379
2379
  };
2380
2380
  };
2381
2381
 
2382
+ // ../core/dist/signing.js
2383
+ var encoder = new TextEncoder();
2384
+ var toBase64 = (bytes) => {
2385
+ let binary = "";
2386
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
2387
+ binary += String.fromCharCode(byte);
2388
+ }
2389
+ return btoa(binary);
2390
+ };
2391
+ var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
2392
+ var timingSafeEqual = (a, b) => {
2393
+ if (a.length !== b.length)
2394
+ return false;
2395
+ let diff = 0;
2396
+ for (let i = 0; i < a.length; i++)
2397
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2398
+ return diff === 0;
2399
+ };
2400
+
2382
2401
  // ../core/dist/surface.js
2383
2402
  var defineMock = (runtime) => runtime;
2384
2403
  var ADMIN_ROUTE_REFERENCE = {
@@ -2497,6 +2516,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2497
2516
  }
2498
2517
  };
2499
2518
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2519
+ var hasAdminKey = (headers, adminKey) => {
2520
+ const sent = headers.get(ADMIN_KEY_HEADER);
2521
+ return sent !== null && timingSafeEqual(sent, adminKey);
2522
+ };
2500
2523
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2501
2524
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2502
2525
  var ADMIN_CONTROL_PAGES = [
@@ -2970,7 +2993,7 @@ var createControlPlane = (context) => {
2970
2993
  }
2971
2994
  const path = url.pathname.slice(adminPrefix.length) || "/";
2972
2995
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
2973
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
2996
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
2974
2997
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
2975
2998
  }
2976
2999
  for (const route of routes) {
@@ -3753,18 +3776,7 @@ var stateAdminRoutes = (routes) => {
3753
3776
  };
3754
3777
 
3755
3778
  // ../core/dist/version.js
3756
- var PACKAGE_VERSION = true ? "3.10.5" : UNRELEASED_VERSION;
3757
-
3758
- // ../core/dist/signing.js
3759
- var encoder = new TextEncoder();
3760
- var toBase64 = (bytes) => {
3761
- let binary = "";
3762
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
3763
- binary += String.fromCharCode(byte);
3764
- }
3765
- return btoa(binary);
3766
- };
3767
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
3779
+ var PACKAGE_VERSION = true ? "3.10.6" : UNRELEASED_VERSION;
3768
3780
 
3769
3781
  // ../core/dist/webhooks.js
3770
3782
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -4745,7 +4757,7 @@ var createRuntime = (options) => {
4745
4757
  throw error;
4746
4758
  }
4747
4759
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
4748
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
4760
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
4749
4761
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
4750
4762
  controls.ensure(namespace);
4751
4763
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -7211,4 +7223,4 @@ export {
7211
7223
  keyCredential,
7212
7224
  GoogleMapsAPI
7213
7225
  };
7214
- //# sourceMappingURL=chunk-YC2JFPL3.js.map
7226
+ //# sourceMappingURL=chunk-PF6TYQMS.js.map