The webmail half of inbuxa's DLP (dlp-and-mail-flow-rules spec, §2.5,
§4):
- A send the server's DLP rules refuse (inbuxa:dlpWarning or
inbuxa:dlpBlocked) comes back to the composer with the rules' notices
instead of a generic "Send failed". A warning offers "Send anyway…",
which asks for a reason and sends again with inbuxa:dlpOverride; the
server records the reason. A block can only be answered by changing
the message.
- A message DLP held for review says so on sending ("Held for review:
it's sent once a reviewer releases it"), from the submission's
inbuxa:held.
- Tests: the override travels with the submission only when there's a
reason; refusals are told apart from other errors.
Nine new English strings (the notice labels, the prompt, the toasts);
the other catalogs fall back to English until translated.
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2026 Coffey Labs
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
// inbuxa: DLP on send: the override travels with the submission, and the
|
|
// server's refusals are told apart from other errors.
|
|
import { describe, expect, it } from "vitest";
|
|
import { buildSubmission, dlpRefusalOf } from "../compose";
|
|
|
|
const base = {
|
|
identityId: "i1",
|
|
fromEmail: "[email protected]",
|
|
emailRef: "#m",
|
|
rcpts: [{ email: "[email protected]" }],
|
|
sentId: "sent",
|
|
draftsId: "drafts",
|
|
scheduledId: null,
|
|
sendAt: null,
|
|
};
|
|
|
|
describe("DLP on send", () => {
|
|
it("sends the override reason only when there is one", () => {
|
|
expect(buildSubmission(base).create["inbuxa:dlpOverride"]).toBeUndefined();
|
|
expect(buildSubmission({ ...base, dlpOverride: " " }).create["inbuxa:dlpOverride"]).toBeUndefined();
|
|
expect(buildSubmission({ ...base, dlpOverride: " Client asked " }).create["inbuxa:dlpOverride"]).toEqual({ reason: "Client asked" });
|
|
});
|
|
|
|
it("recognizes the server's refusals", () => {
|
|
expect(dlpRefusalOf({ type: "inbuxa:dlpWarning", rules: [{ name: "Cards", notice: "Looks like a card." }] })).toEqual({
|
|
kind: "warning",
|
|
rules: [{ name: "Cards", notice: "Looks like a card." }],
|
|
});
|
|
expect(dlpRefusalOf({ type: "inbuxa:dlpBlocked" })).toEqual({ kind: "blocked", rules: [] });
|
|
expect(dlpRefusalOf({ type: "forbiddenToSend" })).toBeNull();
|
|
expect(dlpRefusalOf(undefined)).toBeNull();
|
|
});
|
|
});
|