Skip to content
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
59ed0a8
quick fix
kubasobon Dec 11, 2025
43f3541
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 11, 2025
715759a
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine Dec 11, 2025
ae924c4
improve method readability
kubasobon Dec 15, 2025
4c5f8e6
Merge branch 'fix-entity-store-api-list' of github.com:elastic/kibana…
kubasobon Dec 15, 2025
1faa5a7
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 15, 2025
0e52158
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 15, 2025
ef68153
silence eslint
kubasobon Dec 15, 2025
14d391a
Merge branch 'fix-entity-store-api-list' of github.com:elastic/kibana…
kubasobon Dec 15, 2025
e79fc04
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 15, 2025
67f01aa
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
ba85833
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine Dec 16, 2025
d01f028
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
10a67d3
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
889bded
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
07ec7d1
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
2aeb199
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
ec05c40
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
ba25c19
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
496c9d6
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
847eb93
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
1dad5fb
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
eedca2b
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
f92c26c
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 16, 2025
9adb2ee
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 17, 2025
4715615
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 17, 2025
1866e64
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 17, 2025
f5cbfac
Merge branch 'main' into fix-entity-store-api-list
kubasobon Dec 17, 2025
aafe525
apply review remarks
kubasobon Dec 17, 2025
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 @@ -4,16 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: List Entity Store engines
* version: 1
*/

import type { IKibanaResponse, Logger } from '@kbn/core/server';
import { buildSiemResponse } from '@kbn/lists-plugin/server/routes/utils';
import { transformError } from '@kbn/securitysolution-es-utils';
Expand Down Expand Up @@ -79,6 +69,16 @@ export const listEntitiesRoute = (
sortOrder,
});

// just override the entity field with the normalized fields
records.forEach((record) => {
const result = buildNormalizedFields(record.entity, [
'behaviors',
'lifecycle',
'attributes',
]);
record.entity = { ...record.entity, ...result };
});

telemetry.reportEBT(ENTITY_STORE_API_CALL_EVENT, {
endpoint: request.route.path,
});
Expand Down Expand Up @@ -106,3 +106,19 @@ export const listEntitiesRoute = (
}
);
};

function buildNormalizedFields(obj: Record<string, unknown>, properties: string[]) {
// only use properties whose val is an object, skip them if undefined or some other type
const hasObjVal = (p: string) =>
obj[p] !== null && typeof obj[p] === 'object' && !Array.isArray(obj[p]);
const entries = properties
.filter(hasObjVal)
.map((p) => [p, toLowercaseKeys(obj[p] as Record<string, unknown>)]);
return Object.fromEntries(entries);
}

function toLowercaseKeys(obj: Record<string, unknown>): Record<string, unknown> {
// iterate to rebuild the sub object with the lowercase keys.
// No need for checking if it appears in the old sub or to `delete`
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k.toLowerCase(), v]));
}