fix: align shell allowlist handling (#11510) (#11813)

This commit is contained in:
cornmander
2025-10-23 16:55:01 -04:00
committed by GitHub
parent 48ff9e1555
commit 5e70a7dd46
3 changed files with 76 additions and 5 deletions
+12
View File
@@ -480,6 +480,18 @@ describe('ShellTool', () => {
invocation.shouldConfirmExecute(new AbortController().signal),
).rejects.toThrow('wc');
});
it('should require all segments of a chained command to be allowlisted', async () => {
(mockConfig.getAllowedTools as Mock).mockReturnValue([
'ShellTool(echo)',
]);
const invocation = shellTool.build({ command: 'echo "foo" && ls -l' });
await expect(
invocation.shouldConfirmExecute(new AbortController().signal),
).rejects.toThrow(
'Command "echo "foo" && ls -l" is not in the list of allowed tools for non-interactive mode.',
);
});
});
});