test: cover relay diff traversal rejection
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
committed by
Neil
co-authored by
Orca
parent
6c9332004e
commit
3ae32ee9e6
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user