@crvouga/mockingbird-service-fcm 2.10.5 → 2.10.7

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/dist/admin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fcmCredential
3
- } from "./chunk-7FHD4M64.js";
3
+ } from "./chunk-H2HUYYC3.js";
4
4
 
5
5
  // src/admin.ts
6
6
  import { Agent, createServer } from "node:https";
@@ -9,7 +9,7 @@ import {
9
9
  parseFaultHeader,
10
10
  resolveAdminPrefix,
11
11
  restoreClock
12
- } from "./chunk-7FHD4M64.js";
12
+ } from "./chunk-H2HUYYC3.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 ?? "2.10.5" });
3060
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "2.10.7" });
3061
3061
  } catch (error) {
3062
3062
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3063
3063
  }
@@ -5025,4 +5025,4 @@ export {
5025
5025
  createServer2 as createServer,
5026
5026
  serveTarget
5027
5027
  };
5028
- //# sourceMappingURL=chunk-VNYD5QSJ.js.map
5028
+ //# sourceMappingURL=chunk-A5MO4ZGW.js.map
@@ -2666,6 +2666,17 @@ var createNamespaceControls = (options) => {
2666
2666
  };
2667
2667
  };
2668
2668
 
2669
+ // ../core/dist/signing.js
2670
+ var encoder = new TextEncoder();
2671
+ var timingSafeEqual = (a, b) => {
2672
+ if (a.length !== b.length)
2673
+ return false;
2674
+ let diff = 0;
2675
+ for (let i = 0; i < a.length; i++)
2676
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2677
+ return diff === 0;
2678
+ };
2679
+
2669
2680
  // ../core/dist/surface.js
2670
2681
  var defineMock = (runtime) => runtime;
2671
2682
  var ADMIN_ROUTE_REFERENCE = {
@@ -2784,6 +2795,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2784
2795
  }
2785
2796
  };
2786
2797
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2798
+ var hasAdminKey = (headers, adminKey) => {
2799
+ const sent = headers.get(ADMIN_KEY_HEADER);
2800
+ return sent !== null && timingSafeEqual(sent, adminKey);
2801
+ };
2787
2802
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2788
2803
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2789
2804
  var ADMIN_CONTROL_PAGES = [
@@ -3257,7 +3272,7 @@ var createControlPlane = (context) => {
3257
3272
  }
3258
3273
  const path = url.pathname.slice(adminPrefix.length) || "/";
3259
3274
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3260
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3275
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
3261
3276
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3262
3277
  }
3263
3278
  for (const route of routes) {
@@ -4025,7 +4040,7 @@ var stateAdminRoutes = (routes) => {
4025
4040
  };
4026
4041
 
4027
4042
  // ../core/dist/version.js
4028
- var PACKAGE_VERSION = true ? "2.10.5" : UNRELEASED_VERSION;
4043
+ var PACKAGE_VERSION = true ? "2.10.7" : UNRELEASED_VERSION;
4029
4044
 
4030
4045
  // ../core/dist/webhooks.js
4031
4046
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -5006,7 +5021,7 @@ var createRuntime = (options) => {
5006
5021
  throw error;
5007
5022
  }
5008
5023
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5009
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5024
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5010
5025
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5011
5026
  controls.ensure(namespace);
5012
5027
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -6155,4 +6170,4 @@ export {
6155
6170
  fcmCredential,
6156
6171
  FcmAPI
6157
6172
  };
6158
- //# sourceMappingURL=chunk-7FHD4M64.js.map
6173
+ //# sourceMappingURL=chunk-H2HUYYC3.js.map