Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -1,7 +1,7 @@
import { describe, expect, test } from "vitest";
import { verifyMailjetWebhookAuth, type MailjetWebhookAuthResult } from "./mailjet-webhook-auth.js";
const secret = "whsec_test_secret";
const secret = "whsec_test_secret_with_at_least_32_bytes";
function basicHeader(username: string, password: string) {
return `Basic ${Buffer.from(`${username}:${password}`, "utf8").toString("base64")}`;
@@ -24,6 +24,7 @@ describe("verifyMailjetWebhookAuth", () => {
reason: "missing-secret",
});
expect(verifyMailjetWebhookAuth({ secret: undefined, headers: {} })).toEqual({ ok: false, reason: "missing-secret" });
expect(verifyMailjetWebhookAuth({ secret: "too-short", headers: {} })).toEqual({ ok: false, reason: "missing-secret" });
});
test("returns missing-credentials when the Authorization header is absent", () => {
@@ -26,8 +26,11 @@ export type VerifyMailjetWebhookAuthInput = {
headers: Headers | Record<string, string | string[] | null | undefined>;
};
const MIN_WEBHOOK_SECRET_BYTES = 32;
export function verifyMailjetWebhookAuth({ secret, headers }: VerifyMailjetWebhookAuthInput): MailjetWebhookAuthResult {
if (!secret || secret.trim().length === 0) {
const normalizedSecret = secret?.trim() ?? "";
if (Buffer.byteLength(normalizedSecret, "utf8") < MIN_WEBHOOK_SECRET_BYTES) {
return { ok: false, reason: "missing-secret" };
}
@@ -42,7 +45,7 @@ export function verifyMailjetWebhookAuth({ secret, headers }: VerifyMailjetWebho
}
const provided = Buffer.from(password, "utf8");
const expected = Buffer.from(secret, "utf8");
const expected = Buffer.from(normalizedSecret, "utf8");
if (provided.length !== expected.length || !timingSafeEqual(provided, expected)) {
return { ok: false, reason: "credentials-mismatch" };
}