fix(api): escape filter values, clamp pagination, remove redundant ConfigModule import
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -85,4 +85,22 @@ describe('SearchService', () => {
|
||||
expect.objectContaining({ page: 1, hitsPerPage: 20 }),
|
||||
);
|
||||
});
|
||||
|
||||
it('escapes double-quotes in groupId to prevent filter injection', async () => {
|
||||
mockSearch.mockResolvedValue({ hits: [], totalHits: 0 });
|
||||
await service.search('hello', 'grp"1"OR id EXISTS');
|
||||
expect(mockSearch).toHaveBeenCalledWith(
|
||||
'hello',
|
||||
expect.objectContaining({ filter: 'sourceGroupId = "grp\\"1\\"OR id EXISTS"' }),
|
||||
);
|
||||
});
|
||||
|
||||
it('clamps page to minimum 1 and limit to maximum 100', async () => {
|
||||
mockSearch.mockResolvedValue({ hits: [], totalHits: 0 });
|
||||
await service.search('hello', undefined, undefined, 0, 999);
|
||||
expect(mockSearch).toHaveBeenCalledWith(
|
||||
'hello',
|
||||
expect.objectContaining({ page: 1, hitsPerPage: 100 }),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user