@crvouga/mockingbird-service-polar 0.3.5 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog — @crvouga/mockingbird-service-polar
2
2
 
3
+ ## 0.3.7 (2026-11-02)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - save and replay a 500 the endpoint produced under an Idempotency-Key ([789bbcc](https://github.com/crvouga/mockingbird/commit/789bbcccb792cddaf27f4f6db6d2fcf2da1d07fe))
8
+
9
+ ## 0.3.6 (2026-11-02)
10
+
11
+ ### Fixes and improvements
12
+
13
+ - compare the admin key in constant time ([2a43141](https://github.com/crvouga/mockingbird/commit/2a43141f50dab41e698c3bbce0c69bf65b40e24e))
14
+
3
15
  ## 0.3.5 (2026-11-02)
4
16
 
5
17
  ### Fixes and improvements
@@ -9,7 +9,7 @@ import {
9
9
  parseFaultHeader,
10
10
  resolveAdminPrefix,
11
11
  restoreClock
12
- } from "./chunk-OVEPKQKI.js";
12
+ } from "./chunk-TM6ZUMJQ.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.5" });
3060
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "0.3.7" });
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-DPJNH2TH.js.map
5017
+ //# sourceMappingURL=chunk-PRV637IK.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) {
@@ -4043,7 +4058,7 @@ var stateAdminRoutes = (routes) => {
4043
4058
  };
4044
4059
 
4045
4060
  // ../core/dist/version.js
4046
- var PACKAGE_VERSION = true ? "0.3.5" : UNRELEASED_VERSION;
4061
+ var PACKAGE_VERSION = true ? "0.3.7" : UNRELEASED_VERSION;
4047
4062
 
4048
4063
  // ../core/dist/webhooks.js
4049
4064
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -5022,7 +5037,7 @@ var createRuntime = (options) => {
5022
5037
  throw error;
5023
5038
  }
5024
5039
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5025
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5040
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5026
5041
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5027
5042
  controls.ensure(namespace);
5028
5043
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -5801,4 +5816,4 @@ export {
5801
5816
  DEFAULT_SETTINGS,
5802
5817
  PolarAPI
5803
5818
  };
5804
- //# sourceMappingURL=chunk-OVEPKQKI.js.map
5819
+ //# sourceMappingURL=chunk-TM6ZUMJQ.js.map