|
1 |
| -import { assertExecutedCommands, closeWithSuccess, like, newSimpleGit } from './__fixtures__'; |
2 |
| -import { SimpleGit } from "../../typings"; |
| 1 | +import { promiseError } from '@kwsites/promise-result'; |
| 2 | +import { assertExecutedCommands, assertGitError, closeWithSuccess, like, newSimpleGit } from './__fixtures__'; |
| 3 | +import { SimpleGit } from '../../typings'; |
3 | 4 |
|
4 |
| -describe('push', () => { |
| 5 | +describe('fetch', () => { |
5 | 6 | let git: SimpleGit;
|
6 | 7 | let callback: jest.Mock;
|
7 | 8 |
|
@@ -58,4 +59,30 @@ describe('push', () => {
|
58 | 59 | assertExecutedCommands('fetch', '--all', '-v');
|
59 | 60 | });
|
60 | 61 |
|
| 62 | + |
| 63 | + describe('failures', () => { |
| 64 | + |
| 65 | + it('disallows upload-pack as remote/branch', async () => { |
| 66 | + const error = await promiseError(git.fetch('origin', '--upload-pack=touch ./foo')); |
| 67 | + |
| 68 | + assertGitError(error, 'potential exploit argument blocked'); |
| 69 | + }); |
| 70 | + |
| 71 | + it('disallows upload-pack as varargs', async () => { |
| 72 | + const error = await promiseError(git.fetch('origin', 'main', { |
| 73 | + '--upload-pack': 'touch ./foo' |
| 74 | + })); |
| 75 | + |
| 76 | + assertGitError(error, 'potential exploit argument blocked'); |
| 77 | + }); |
| 78 | + |
| 79 | + it('disallows upload-pack as varargs', async () => { |
| 80 | + const error = await promiseError(git.fetch('origin', 'main', [ |
| 81 | + '--upload-pack', 'touch ./foo' |
| 82 | + ])); |
| 83 | + |
| 84 | + assertGitError(error, 'potential exploit argument blocked'); |
| 85 | + }); |
| 86 | + |
| 87 | + }) |
61 | 88 | });
|
0 commit comments