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 33303 additions and 3737 deletions
+19 -1
View File
@@ -1,6 +1,10 @@
import { describe, expect, it } from 'vitest'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { getGitCloneFailureMessage } from './git-clone-failure-message'
afterEach(() => {
vi.restoreAllMocks()
})
describe('getGitCloneFailureMessage', () => {
it('turns an existing destination into an actionable message after progress output', () => {
expect(
@@ -41,4 +45,18 @@ describe('getGitCloneFailureMessage', () => {
'network vanished'
)
})
it('summarizes CRLF-heavy stderr without line-array splitting', () => {
const splitSpy = vi.spyOn(String.prototype, 'split')
const stderr = `${'remote: counting objects\r\n'.repeat(10_000)}fatal: repository not found\r\n`
expect(getGitCloneFailureMessage(stderr)).toBe('fatal: repository not found')
const usedLineSplit = splitSpy.mock.calls.some(
([separator]) =>
(typeof separator === 'string' && separator === '\n') ||
(separator instanceof RegExp && separator.source === '\\r?\\n')
)
expect(usedLineSplit).toBe(false)
})
})