mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 08:01:56 +00:00
Prevent unscoped GitHub task queries for SSH repos (#2506)
* fix: prevent unscoped ssh github task queries Co-authored-by: Orca <help@stably.ai> * test: update worktree card context menu mock Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -36,7 +36,8 @@ vi.mock('./gh-utils', () => ({
|
||||
repoPath,
|
||||
connectionId: connectionId ?? null
|
||||
}),
|
||||
ghRepoExecOptions: (context: { repoPath: string }) => ({ cwd: context.repoPath }),
|
||||
ghRepoExecOptions: (context: { repoPath: string; connectionId?: string | null }) =>
|
||||
context.connectionId ? {} : { cwd: context.repoPath },
|
||||
getOwnerRepo: getOwnerRepoMock,
|
||||
getIssueOwnerRepo: getIssueOwnerRepoMock,
|
||||
getOwnerRepoForRemote: getOwnerRepoForRemoteMock,
|
||||
@@ -548,4 +549,27 @@ describe('listWorkItems', () => {
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('rejects unresolved SSH repositories without running unscoped GitHub work-item queries', async () => {
|
||||
getIssueOwnerRepoMock.mockResolvedValue(null)
|
||||
getOwnerRepoMock.mockResolvedValue(null)
|
||||
getOwnerRepoForRemoteMock.mockResolvedValue(null)
|
||||
|
||||
await expect(
|
||||
listWorkItems('/remote/repo', 10, undefined, undefined, undefined, 'ssh-1')
|
||||
).rejects.toThrow('GitHub work items require a GitHub remote for SSH repositories')
|
||||
|
||||
expect(ghExecFileAsyncMock).not.toHaveBeenCalled()
|
||||
|
||||
ghExecFileAsyncMock.mockClear()
|
||||
getIssueOwnerRepoMock.mockResolvedValue(null)
|
||||
getOwnerRepoMock.mockResolvedValue(null)
|
||||
getOwnerRepoForRemoteMock.mockResolvedValue(null)
|
||||
|
||||
await expect(
|
||||
listWorkItems('/remote/repo', 10, 'is:open', undefined, undefined, 'ssh-1')
|
||||
).rejects.toThrow('GitHub work items require a GitHub remote for SSH repositories')
|
||||
|
||||
expect(ghExecFileAsyncMock).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user