Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+45
@@ -189,6 +189,51 @@ describe("buildRfc2822Message", () => {
|
||||
expect(raw).toContain(`Subject: =?UTF-8?B?${Buffer.from("Rückfrage Wärmepumpe", "utf8").toString("base64")}?=`);
|
||||
expect(raw).toContain("=?UTF-8?B?");
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ field: "subject", input: { subject: "Hello\r\nBcc: victim@example.test" } },
|
||||
{ field: "from address", input: { fromAddress: "sender@example.test\r\nBcc: victim@example.test" } },
|
||||
{ field: "display name", input: { to: [{ address: "max@kunde.de", name: "Max\r\nBcc: victim@example.test" }] } },
|
||||
{ field: "message id", input: { inReplyToInternetMessageId: "id@example.test\r\nBcc: victim@example.test" } },
|
||||
])("rejects RFC-2822 header injection through $field", ({ input }) => {
|
||||
expect(() =>
|
||||
buildRfc2822Message({
|
||||
fromAddress: "info@handwerk.de",
|
||||
to: [{ address: "max@kunde.de" }],
|
||||
subject: "Safe subject",
|
||||
bodyHtml: "<p>x</p>",
|
||||
...input,
|
||||
}),
|
||||
).toThrow(TypeError);
|
||||
});
|
||||
|
||||
it("rejects attachment headers and bodies that can escape the MIME part", () => {
|
||||
const base = {
|
||||
fromAddress: "info@handwerk.de",
|
||||
to: [{ address: "max@kunde.de" }],
|
||||
subject: "Safe subject",
|
||||
bodyHtml: "<p>x</p>",
|
||||
};
|
||||
|
||||
expect(() =>
|
||||
buildRfc2822Message({
|
||||
...base,
|
||||
attachments: [{ filename: "safe.pdf\r\nBcc: victim@example.test", mimeType: "application/pdf", contentBase64: "QUJD" }],
|
||||
}),
|
||||
).toThrow(TypeError);
|
||||
expect(() =>
|
||||
buildRfc2822Message({
|
||||
...base,
|
||||
attachments: [{ filename: "safe.pdf", mimeType: "application/pdf\r\nBcc: victim@example.test", contentBase64: "QUJD" }],
|
||||
}),
|
||||
).toThrow(TypeError);
|
||||
expect(() =>
|
||||
buildRfc2822Message({
|
||||
...base,
|
||||
attachments: [{ filename: "safe.pdf", mimeType: "application/pdf", contentBase64: "QUJD\r\n--forged-boundary" }],
|
||||
}),
|
||||
).toThrow(TypeError);
|
||||
});
|
||||
});
|
||||
|
||||
describe("toBase64Url", () => {
|
||||
|
||||
Reference in new issue
Block a user