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:
@@ -0,0 +1,15 @@
|
||||
export const CLIPBOARD_WRITE_MAX_BYTES = 1024 * 1024;
|
||||
|
||||
export function validateClipboardWriteText(value: unknown): string {
|
||||
if (typeof value !== "string") {
|
||||
throw new Error("text muss ein String sein");
|
||||
}
|
||||
if (!value.trim()) {
|
||||
throw new Error("text darf nicht leer sein");
|
||||
}
|
||||
const bytes = Buffer.byteLength(value, "utf8");
|
||||
if (bytes > CLIPBOARD_WRITE_MAX_BYTES) {
|
||||
throw new Error(`text ist zu groß (max ${CLIPBOARD_WRITE_MAX_BYTES} Bytes)`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
Reference in New Issue
Block a user