Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution][Detections] Broken value lists #186990

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type FindListsCursor = z.infer<typeof FindListsCursor>;
export const FindListsCursor = NonEmptyString;

export type FindListsFilter = z.infer<typeof FindListsFilter>;
export const FindListsFilter = NonEmptyString;
export const FindListsFilter = z.string();

export type FindListsRequestQuery = z.infer<typeof FindListsRequestQuery>;
export const FindListsRequestQuery = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ components:
$ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'

FindListsFilter:
$ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
type: string
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type FindListItemsCursor = z.infer<typeof FindListItemsCursor>;
export const FindListItemsCursor = NonEmptyString;

export type FindListItemsFilter = z.infer<typeof FindListItemsFilter>;
export const FindListItemsFilter = NonEmptyString;
export const FindListItemsFilter = z.string();

export type FindListItemsRequestQuery = z.infer<typeof FindListItemsRequestQuery>;
export const FindListItemsRequestQuery = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ components:
$ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'

FindListItemsFilter:
$ref: '../../../kbn-openapi-common/schemas/primitives.schema.yaml#/components/schemas/NonEmptyString'
type: string
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,28 @@ export default ({ getService }: FtrProviderContext): void => {
});
});

it('should accept empty string filter', async () => {
await supertest
.post(LIST_URL)
.set('kbn-xsrf', 'true')
.send(getCreateMinimalListSchemaMock())
.expect(200);

const { body } = await supertest
.get(`${LIST_ITEM_URL}/_find?list_id=${LIST_ID}&filter=`)
.set('kbn-xsrf', 'true')
.send()
.expect(200);

expect(body).toEqual({
cursor: 'WzBd',
data: [],
page: 1,
per_page: 20,
total: 0,
});
});

it('should return a single list item when a single list item is loaded from a find with defaults added', async () => {
const listMock = getCreateMinimalListSchemaMock();
const listItemMock = getCreateMinimalListItemSchemaMock();
Expand Down