@crvouga/mockingbird-service-odx 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 +6 -0
- package/dist/{chunk-OEAV5IOZ.js → chunk-GZVFA5Y4.js} +3 -3
- package/dist/{chunk-QI6UT6BW.js → chunk-S3RQHRYC.js} +48 -36
- package/dist/chunk-S3RQHRYC.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.js +1 -1
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-QI6UT6BW.js.map +0 -7
- /package/dist/{chunk-OEAV5IOZ.js.map → chunk-GZVFA5Y4.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-odx
|
|
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
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
parseFaultHeader,
|
|
10
10
|
resolveAdminPrefix,
|
|
11
11
|
restoreClock
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-S3RQHRYC.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.
|
|
3060
|
+
targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.6" });
|
|
3061
3061
|
} catch (error) {
|
|
3062
3062
|
throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
3063
3063
|
}
|
|
@@ -5041,4 +5041,4 @@ export {
|
|
|
5041
5041
|
createServer2 as createServer,
|
|
5042
5042
|
serveTarget
|
|
5043
5043
|
};
|
|
5044
|
-
//# sourceMappingURL=chunk-
|
|
5044
|
+
//# sourceMappingURL=chunk-GZVFA5Y4.js.map
|
|
@@ -2379,6 +2379,46 @@ 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 toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
2393
|
+
var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
|
|
2394
|
+
var hmac = async (algorithm, key, message2, encoding = "hex") => {
|
|
2395
|
+
const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
|
|
2396
|
+
const signed = await crypto.subtle.sign("HMAC", imported, typeof message2 === "string" ? encoder.encode(message2) : message2);
|
|
2397
|
+
return encoding === "hex" ? toHex(signed) : toBase64(signed);
|
|
2398
|
+
};
|
|
2399
|
+
var svixSecretBytes = (secret) => {
|
|
2400
|
+
const raw = secret.replace(/^f?whsec_/, "");
|
|
2401
|
+
try {
|
|
2402
|
+
return fromBase64(raw);
|
|
2403
|
+
} catch {
|
|
2404
|
+
throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
|
|
2408
|
+
var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
|
|
2409
|
+
var signTwilio = async (authToken, url, params) => {
|
|
2410
|
+
const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
|
|
2411
|
+
return hmac("SHA-1", authToken, payload, "base64");
|
|
2412
|
+
};
|
|
2413
|
+
var timingSafeEqual = (a, b) => {
|
|
2414
|
+
if (a.length !== b.length)
|
|
2415
|
+
return false;
|
|
2416
|
+
let diff = 0;
|
|
2417
|
+
for (let i = 0; i < a.length; i++)
|
|
2418
|
+
diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
2419
|
+
return diff === 0;
|
|
2420
|
+
};
|
|
2421
|
+
|
|
2382
2422
|
// ../core/dist/surface.js
|
|
2383
2423
|
var defineMock = (runtime) => runtime;
|
|
2384
2424
|
var ADMIN_ROUTE_REFERENCE = {
|
|
@@ -2497,6 +2537,10 @@ var assertAdminPrefixAvailable = (prefix, paths) => {
|
|
|
2497
2537
|
}
|
|
2498
2538
|
};
|
|
2499
2539
|
var ADMIN_KEY_HEADER = CONTROL_HEADERS.adminKey;
|
|
2540
|
+
var hasAdminKey = (headers, adminKey) => {
|
|
2541
|
+
const sent = headers.get(ADMIN_KEY_HEADER);
|
|
2542
|
+
return sent !== null && timingSafeEqual(sent, adminKey);
|
|
2543
|
+
};
|
|
2500
2544
|
var NAMESPACE_HEADER = CONTROL_HEADERS.namespace;
|
|
2501
2545
|
var ADMIN_DOCS_URL = "https://mockingbird.chrisvouga.dev/docs/admin-controls";
|
|
2502
2546
|
var ADMIN_CONTROL_PAGES = [
|
|
@@ -2970,7 +3014,7 @@ var createControlPlane = (context) => {
|
|
|
2970
3014
|
}
|
|
2971
3015
|
const path = url.pathname.slice(adminPrefix.length) || "/";
|
|
2972
3016
|
const shell = request.method === "GET" && (path === "/ui" || path === "/ui/");
|
|
2973
|
-
if (!shell && context.adminKey !== void 0 && request.headers
|
|
3017
|
+
if (!shell && context.adminKey !== void 0 && !hasAdminKey(request.headers, context.adminKey)) {
|
|
2974
3018
|
return adminError(401, `missing or wrong ${ADMIN_KEY_HEADER}`);
|
|
2975
3019
|
}
|
|
2976
3020
|
for (const route of routes) {
|
|
@@ -3731,39 +3775,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
3731
3775
|
};
|
|
3732
3776
|
|
|
3733
3777
|
// ../core/dist/version.js
|
|
3734
|
-
var PACKAGE_VERSION = true ? "3.10.
|
|
3735
|
-
|
|
3736
|
-
// ../core/dist/signing.js
|
|
3737
|
-
var encoder = new TextEncoder();
|
|
3738
|
-
var toBase64 = (bytes) => {
|
|
3739
|
-
let binary = "";
|
|
3740
|
-
for (const byte of bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)) {
|
|
3741
|
-
binary += String.fromCharCode(byte);
|
|
3742
|
-
}
|
|
3743
|
-
return btoa(binary);
|
|
3744
|
-
};
|
|
3745
|
-
var fromBase64 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
|
|
3746
|
-
var toHex = (bytes) => [...bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
3747
|
-
var keyBytes = (key) => typeof key === "string" ? encoder.encode(key) : key;
|
|
3748
|
-
var hmac = async (algorithm, key, message2, encoding = "hex") => {
|
|
3749
|
-
const imported = await crypto.subtle.importKey("raw", keyBytes(key), { name: "HMAC", hash: algorithm }, false, ["sign"]);
|
|
3750
|
-
const signed = await crypto.subtle.sign("HMAC", imported, typeof message2 === "string" ? encoder.encode(message2) : message2);
|
|
3751
|
-
return encoding === "hex" ? toHex(signed) : toBase64(signed);
|
|
3752
|
-
};
|
|
3753
|
-
var svixSecretBytes = (secret) => {
|
|
3754
|
-
const raw = secret.replace(/^f?whsec_/, "");
|
|
3755
|
-
try {
|
|
3756
|
-
return fromBase64(raw);
|
|
3757
|
-
} catch {
|
|
3758
|
-
throw new TypeError("webhook secret must be whsec_<base64> (as Svix issues it)");
|
|
3759
|
-
}
|
|
3760
|
-
};
|
|
3761
|
-
var signSvix = async (secret, messageId, timestampSeconds, body) => `v1,${await hmac("SHA-256", svixSecretBytes(secret), `${messageId}.${timestampSeconds}.${body}`, "base64")}`;
|
|
3762
|
-
var signTimestamped = async (secret, timestampSeconds, body) => `t=${timestampSeconds},v1=${await hmac("SHA-256", secret, `${timestampSeconds}.${body}`, "hex")}`;
|
|
3763
|
-
var signTwilio = async (authToken, url, params) => {
|
|
3764
|
-
const payload = url + Object.keys(params).sort().map((key) => `${key}${params[key]}`).join("");
|
|
3765
|
-
return hmac("SHA-1", authToken, payload, "base64");
|
|
3766
|
-
};
|
|
3778
|
+
var PACKAGE_VERSION = true ? "3.10.6" : UNRELEASED_VERSION;
|
|
3767
3779
|
|
|
3768
3780
|
// ../core/dist/webhooks.js
|
|
3769
3781
|
var signers = {
|
|
@@ -5160,7 +5172,7 @@ var createRuntime = (options) => {
|
|
|
5160
5172
|
throw error;
|
|
5161
5173
|
}
|
|
5162
5174
|
const rewinds = at !== void 0 && selectedBranch === "main" && MUTATING_METHODS.has(request.method);
|
|
5163
|
-
if ((requested || rewinds) && options.adminKey !== void 0 && request.headers
|
|
5175
|
+
if ((requested || rewinds) && options.adminKey !== void 0 && !hasAdminKey(request.headers, options.adminKey))
|
|
5164
5176
|
return refuse(401, `control headers need ${ADMIN_KEY_HEADER}`);
|
|
5165
5177
|
controls.ensure(namespace);
|
|
5166
5178
|
if (requested?.restore !== void 0 && !snapshotStore.get(namespace, requested.restore))
|
|
@@ -6480,4 +6492,4 @@ export {
|
|
|
6480
6492
|
apiKeyCredential,
|
|
6481
6493
|
OdxAPI
|
|
6482
6494
|
};
|
|
6483
|
-
//# sourceMappingURL=chunk-
|
|
6495
|
+
//# sourceMappingURL=chunk-S3RQHRYC.js.map
|