fix(clipboard): route copy actions through Electron

Replace renderer clipboard calls with the validated main-process IPC writer for link names, URLs, package batches, backup keys, diagnostics, error details, and masked account identifiers. Raise the validated payload limit to one MiB so complete link packages copy without truncation while preserving empty and oversized input rejection.
This commit is contained in:
Sucukdeluxe
2026-08-24 00:19:00 +02:00
parent 581736e02b
commit 20be2a9a03
7 changed files with 253 additions and 57 deletions
+15
View File
@@ -0,0 +1,15 @@
import { describe, expect, it } from "vitest";
import { CLIPBOARD_WRITE_MAX_BYTES, validateClipboardWriteText } from "../src/main/clipboard-write";
describe("clipboard write validation", () => {
it("accepts complete large link packages up to one MiB", () => {
const text = "x".repeat(CLIPBOARD_WRITE_MAX_BYTES);
expect(validateClipboardWriteText(text)).toBe(text);
});
it("rejects empty, non-string and oversized payloads", () => {
expect(() => validateClipboardWriteText(" \n ")).toThrow(/leer/i);
expect(() => validateClipboardWriteText(4)).toThrow(/String/i);
expect(() => validateClipboardWriteText("x".repeat(CLIPBOARD_WRITE_MAX_BYTES + 1))).toThrow(/zu groß/i);
});
});