DLP on send: warnings, blocks and held mail in the composer
ci / version (pull_request) Skipped
ci / node (pull_request) Successful in 2m13s
ci / publish (pull_request) Skipped
ci / announce (pull_request) Skipped
ci / docker-build (pull_request) Successful in 1m13s

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.
This commit is contained in:
jcoffey-dev committed 2026-09-28 18:51:45 -07:00
1 parent 290bc63dbb
commit 07cfe1310e
4 files changed
+134 -7

No files matched your search

@@ -0,0 +1,39 @@
/*
* 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();
});
});