@crvouga/mockingbird-service-emqx 0.9.3 → 0.9.5

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,9 +1,23 @@
1
1
  # Changelog — @crvouga/mockingbird-service-emqx
2
2
 
3
+ ## 0.9.5 (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
+
9
+ ## 0.9.4 (2026-11-02)
10
+
11
+ ### Fixes and improvements
12
+
13
+ - stop walkSchema recursing forever on a self-referential $ref ([69464a9](https://github.com/crvouga/mockingbird/commit/69464a9d9e7f468c5e1095125108d4d3d5515431))
14
+ - densify sparse bracket arrays by their written indices ([84a28cb](https://github.com/crvouga/mockingbird/commit/84a28cb182e3d7df91102897f0fc11fca714ba5f))
15
+
3
16
  ## 0.9.3 (2026-11-02)
4
17
 
5
18
  ### Fixes and improvements
6
19
 
20
+ - do not save idempotent results for requests that fail validation ([f2161aa](https://github.com/crvouga/mockingbird/commit/f2161aadeae30bcc586e26131da12a7030bdeb11))
7
21
  - keep the command palette's highlighted option in view and announced ([24b8a92](https://github.com/crvouga/mockingbird/commit/24b8a923f65d9deecb2c298169cdc9b7af90e609))
8
22
 
9
23
  ## 0.9.2 (2026-11-02)
@@ -495,6 +495,7 @@ var parsePath = (rawKey) => {
495
495
  return path;
496
496
  };
497
497
  var isIndex = (segment) => /^(0|[1-9][0-9]*)$/.test(segment);
498
+ var MAX_ARRAY_INDEX = 4294967294;
498
499
  var put = (target, key, value) => {
499
500
  if (key === "__proto__") {
500
501
  Object.defineProperty(target, key, {
@@ -557,8 +558,17 @@ var decodeFormPairs = (pairs) => {
557
558
  var densify = (value) => {
558
559
  if (typeof value === "string")
559
560
  return value;
560
- if (Array.isArray(value))
561
- return value.filter((item) => item !== void 0).map(densify);
561
+ if (Array.isArray(value)) {
562
+ const dense = [];
563
+ for (const key of Object.keys(value)) {
564
+ if (!isIndex(key) || Number(key) > MAX_ARRAY_INDEX)
565
+ continue;
566
+ const item = value[Number(key)];
567
+ if (item !== void 0)
568
+ dense.push(densify(item));
569
+ }
570
+ return dense;
571
+ }
562
572
  const out = {};
563
573
  for (const [key, item] of Object.entries(value))
564
574
  put(out, key, densify(item));
@@ -4685,6 +4695,25 @@ var createNamespaceControls = (options) => {
4685
4695
  };
4686
4696
  };
4687
4697
 
4698
+ // ../core/dist/signing.js
4699
+ var encoder = new TextEncoder();
4700
+ var toBase64 = (bytes) => {
4701
+ let binary = "";
4702
+ for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
4703
+ binary += String.fromCharCode(byte);
4704
+ }
4705
+ return btoa(binary);
4706
+ };
4707
+ var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
4708
+ var timingSafeEqual = (a, b) => {
4709
+ if (a.length !== b.length)
4710
+ return false;
4711
+ let diff = 0;
4712
+ for (let i = 0; i < a.length; i++)
4713
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
4714
+ return diff === 0;
4715
+ };
4716
+
4688
4717
  // ../core/dist/surface.js
4689
4718
  var defineMock = (runtime) => runtime;
4690
4719
  var ADMIN_ROUTE_REFERENCE = {
@@ -4803,6 +4832,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
4803
4832
  }
4804
4833
  };
4805
4834
  var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
4835
+ var hasAdminKey = (headers, adminKey) => {
4836
+ const sent = headers.get(ADMIN_KEY_HEADER);
4837
+ return sent !== null && timingSafeEqual(sent, adminKey);
4838
+ };
4806
4839
  var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
4807
4840
  var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
4808
4841
  var ADMIN_CONTROL_PAGES = [
@@ -5276,7 +5309,7 @@ var createControlPlane = (context) => {
5276
5309
  }
5277
5310
  const path = url.pathname.slice(adminPrefix.length) || "/";
5278
5311
  const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
5279
- if (!shell && context.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== context.adminKey) {
5312
+ if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
5280
5313
  return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
5281
5314
  }
5282
5315
  for (const route of routes) {
@@ -6055,18 +6088,7 @@ var stateAdminRoutes = (routes) => {
6055
6088
  };
6056
6089
 
6057
6090
  // ../core/dist/version.js
6058
- var PACKAGE_VERSION = true ? "0.9.3" : UNRELEASED_VERSION;
6059
-
6060
- // ../core/dist/signing.js
6061
- var encoder = new TextEncoder();
6062
- var toBase64 = (bytes) => {
6063
- let binary = "";
6064
- for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
6065
- binary += String.fromCharCode(byte);
6066
- }
6067
- return btoa(binary);
6068
- };
6069
- var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
6091
+ var PACKAGE_VERSION = true ? "0.9.5" : UNRELEASED_VERSION;
6070
6092
 
6071
6093
  // ../core/dist/webhooks.js
6072
6094
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -7045,7 +7067,7 @@ var createRuntime = (options) => {
7045
7067
  throw error;
7046
7068
  }
7047
7069
  const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
7048
- if ((requested || rewinds) && options.adminKey !== void 0 && request.headers.get(ADMIN_KEY_HEADER) !== options.adminKey)
7070
+ if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
7049
7071
  return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
7050
7072
  controls.ensure(namespace);
7051
7073
  if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
@@ -9548,4 +9570,4 @@ export {
9548
9570
  apiKeyCredential,
9549
9571
  EmqxAPI
9550
9572
  };
9551
- //# sourceMappingURL=chunk-KS4A6DUT.js.map
9573
+ //# sourceMappingURL=chunk-6SILEQM5.js.map