test: cover relay diff traversal rejection

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo-H
2026-05-31 01:49:29 -07:00
committed by Neil
co-authored by Orca
parent 6c9332004e
commit 3ae32ee9e6
+12
View File
@@ -443,6 +443,18 @@ describe('GitHandler', () => {
expect(result.originalContent).toBe('original')
expect(result.modifiedContent).toBe('modified')
})
it('rejects diff paths that traverse outside the worktree', async () => {
gitInit(tmpDir)
await expect(
dispatcher.callRequest('git.diff', {
worktreePath: tmpDir,
filePath: '../outside.txt',
staged: false
})
).rejects.toThrow('outside the worktree')
})
})
describe('discard', () => {