@crvouga/mockingbird-service-intercom 3.10.5 → 3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog — @crvouga/mockingbird-service-intercom
2
2
 
3
+ ## 3.10.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
+ ## 3.10.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
  ## 3.10.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-L4TBFJ4W.js";
12
+ } from "./chunk-CVFDJM75.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.7" });
3061
3061
  } catch (error) {
3062
3062
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3063
3063
  }
@@ -5058,4 +5058,4 @@ export {
5058
5058
  createServer2 as createServer,
5059
5059
  serveTarget
5060
5060
  };
5061
- //# sourceMappingURL=chunk-MGG3GQIQ.js.map
5061
+ //# sourceMappingURL=chunk-2AZ2CBFB.js.map
@@ -2644,6 +2644,46 @@ var createNamespaceControls = (options) => {
2644
2644
  };
2645
2645
  };
2646
2646
 
2647
+ // ../core/dist/signing.js
2648
+ var encoder = new TextEncoder();
2649
+ var toBase64 = (bytes) => {
2650
+ let binary = "";
2651
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
2652
+ binary += String.fromCharCode(byte);
2653
+ }
2654
+ return btoa(binary);
2655
+ };
2656
+ var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
2657
+ var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
2658
+ var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
2659
+ var hmac = async (algorithm, key, message, encoding = "hex") => {
2660
+ const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
2661
+ const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
2662
+ return encoding === "hex" ? toHex(signed) : toBase64(signed);
2663
+ };
2664
+ var svixSecretBytes = (secret) => {
2665
+ const raw = secret.replace(/^f?whsec_/, "");
2666
+ try {
2667
+ return fromBase64(raw);
2668
+ } catch {
2669
+ throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
2670
+ }
2671
+ };
2672
+ var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
2673
+ var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
2674
+ var signTwilio = async (authToken, url, params) => {
2675
+ const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
2676
+ return hmac("SHA-1", authToken, payload, "base64");
2677
+ };
2678
+ var timingSafeEqual = (a, b) => {
2679
+ if (a.length !== b.length)
2680
+ return false;
2681
+ let diff = 0;
2682
+ for (let i = 0; i < a.length; i++)
2683
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
2684
+ return diff === 0;
2685
+ };
2686
+
2647
2687
  // ../core/dist/surface.js
2648
2688
  var defineMock = (runtime) => runtime;
2649
2689
  var ADMIN_ROUTE_REFERENCE = {
@@ -2762,6 +2802,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
2762
2802
  }
2763
2803
  };
2764
2804
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
2805
+ var hasAdminKey = (headers, adminKey) => {
2806
+ const sent = headers.get(ADMIN_KEY_HEADER);
2807
+ return sent !== null && timingSafeEqual(sent, adminKey);
2808
+ };
2765
2809
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
2766
2810
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
2767
2811
  var ADMIN_CONTROL_PAGES = [
@@ -3235,7 +3279,7 @@ var createControlPlane = (context) => {
3235
3279
  }
3236
3280
  const path = url.pathname.slice(adminPrefix.length) || "/";
3237
3281
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
3238
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
3282
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
3239
3283
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
3240
3284
  }
3241
3285
  for (const route of routes) {
@@ -3335,6 +3379,7 @@ var IdempotencyStore = class {
3335
3379
  * the method, path and canonical body). Only `replayable` responses are stored (default:
3336
3380
  * every status below 500), so a transient failure can be retried. `replayable` also sees the
3337
3381
  * response, for vendors that decide from more than the status.
3382
+ * Stripe also saves endpoint-produced 500 responses.
3338
3383
  */
3339
3384
  async run(key, fingerprint, errors, handler, replayable = (status) => status < 500) {
3340
3385
  const slot = `${this.namespace}\0${key}`;
@@ -4156,39 +4201,7 @@ var stateAdminRoutes = (routes) => {
4156
4201
  };
4157
4202
 
4158
4203
  // ../core/dist/version.js
4159
- var PACKAGE_VERSION = true ? "3.10.5" : UNRELEASED_VERSION;
4160
-
4161
- // ../core/dist/signing.js
4162
- var encoder = new TextEncoder();
4163
- var toBase64 = (bytes) => {
4164
- let binary = "";
4165
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
4166
- binary += String.fromCharCode(byte);
4167
- }
4168
- return btoa(binary);
4169
- };
4170
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
4171
- var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
4172
- var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
4173
- var hmac = async (algorithm, key, message, encoding = "hex") => {
4174
- const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
4175
- const signed = await crypto.subtle.sign("HMAC", imported, typeof message === "string" ? encoder.encode(message) : message);
4176
- return encoding === "hex" ? toHex(signed) : toBase64(signed);
4177
- };
4178
- var svixSecretBytes = (secret) => {
4179
- const raw = secret.replace(/^f?whsec_/, "");
4180
- try {
4181
- return fromBase64(raw);
4182
- } catch {
4183
- throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
4184
- }
4185
- };
4186
- var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
4187
- var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
4188
- var signTwilio = async (authToken, url, params) => {
4189
- const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
4190
- return hmac("SHA-1", authToken, payload, "base64");
4191
- };
4204
+ var PACKAGE_VERSION = true ? "3.10.7" : UNRELEASED_VERSION;
4192
4205
 
4193
4206
  // ../core/dist/webhooks.js
4194
4207
  var signers = {
@@ -5585,7 +5598,7 @@ var createRuntime = (options) => {
5585
5598
  throw error;
5586
5599
  }
5587
5600
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
5588
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
5601
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
5589
5602
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
5590
5603
  controls.ensure(namespace);
5591
5604
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -7276,4 +7289,4 @@ export {
7276
7289
  IntercomError,
7277
7290
  IntercomAPI
7278
7291
  };
7279
- //# sourceMappingURL=chunk-L4TBFJ4W.js.map
7292
+ //# sourceMappingURL=chunk-CVFDJM75.js.map