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
@@ -0,0 +1,28 @@
import { describe, expect, it } from 'vitest'
import {
GITHUB_WORK_ITEMS_QUERY_MAX_BYTES,
isGitHubWorkItemsQueryTooLarge
} from './github-work-items-query-bounds'
describe('shared GitHub work item query bounds', () => {
it('allows normal GitHub search syntax', () => {
expect(isGitHubWorkItemsQueryTooLarge('is:issue is:open label:bug')).toBe(false)
})
it('rejects oversized pasted work item queries by byte length', () => {
expect(isGitHubWorkItemsQueryTooLarge('x'.repeat(GITHUB_WORK_ITEMS_QUERY_MAX_BYTES))).toBe(
false
)
expect(isGitHubWorkItemsQueryTooLarge('x'.repeat(GITHUB_WORK_ITEMS_QUERY_MAX_BYTES + 1))).toBe(
true
)
})
it('rejects multibyte pasted queries whose character count is below the limit', () => {
const query = '😀'.repeat(Math.floor(GITHUB_WORK_ITEMS_QUERY_MAX_BYTES / 4) + 1)
expect(query.length).toBeLessThan(GITHUB_WORK_ITEMS_QUERY_MAX_BYTES)
expect(isGitHubWorkItemsQueryTooLarge(query)).toBe(true)
})
})