Fix paste ownership, input bounds, and IPC validation

Supersedes #5745, #5746, and #5747.
This commit is contained in:
Jinwoo Hong
2026-06-19 17:14:55 -07:00
committed by GitHub
parent a5920b2183
commit 972078f2c4
592 changed files with 33301 additions and 3735 deletions
+19
View File
@@ -0,0 +1,19 @@
import { getClipboardTextByteLength, isClipboardTextByteLengthOverLimit } from './clipboard-text'
export const GITHUB_PROJECT_REF_INPUT_MAX_BYTES = 2 * 1024
export const GITHUB_PROJECT_REF_INPUT_TOO_LARGE_ERROR = 'Project reference is too large to resolve.'
export function getGitHubProjectRefInputByteLength(input: string): number {
return getClipboardTextByteLength(input)
}
export function isGitHubProjectRefInputTooLarge(
input: string,
maxBytes = GITHUB_PROJECT_REF_INPUT_MAX_BYTES
): boolean {
return isClipboardTextByteLengthOverLimit(input, maxBytes)
}
export function hasBoundedGitHubProjectRefInputText(input: string): boolean {
return !isGitHubProjectRefInputTooLarge(input) && /\S/.test(input)
}