Skip to content
Closed
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
8 changes: 8 additions & 0 deletions oas_docs/output/kibana.serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98538,10 +98538,18 @@ components:
additionalProperties: false
type: object
properties:
anomaly_job_ids:
items:
type: string
type: array
brute_force_victim:
type: boolean
new_country_login:
type: boolean
rule_names:
items:
type: string
type: array
used_usb_device:
type: boolean
EngineMetadata:
Expand Down
8 changes: 8 additions & 0 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109283,10 +109283,18 @@ components:
additionalProperties: false
type: object
properties:
anomaly_job_ids:
items:
type: string
type: array
brute_force_victim:
type: boolean
new_country_login:
type: boolean
rule_names:
items:
type: string
type: array
used_usb_device:
type: boolean
EngineMetadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export const EntityField = z
brute_force_victim: z.boolean().optional(),
new_country_login: z.boolean().optional(),
used_usb_device: z.boolean().optional(),
anomaly_job_ids: z.array(z.string()).optional(),
rule_names: z.array(z.string()).optional(),
})
.strict()
.optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ components:
type: boolean
used_usb_device:
type: boolean
anomaly_job_ids:
type: array
items:
type: string
rule_names:
type: array
items:
type: string
lifecycle:
type: object
additionalProperties: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1876,10 +1876,18 @@ components:
additionalProperties: false
type: object
properties:
anomaly_job_ids:
items:
type: string
type: array
brute_force_victim:
type: boolean
new_country_login:
type: boolean
rule_names:
items:
type: string
type: array
used_usb_device:
type: boolean
EngineMetadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1876,10 +1876,18 @@ components:
additionalProperties: false
type: object
properties:
anomaly_job_ids:
items:
type: string
type: array
brute_force_victim:
type: boolean
new_country_login:
type: boolean
rule_names:
items:
type: string
type: array
used_usb_device:
type: boolean
EngineMetadata:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
} from '../../../../../../common/api/entity_analytics/entity_store';
import type { FieldDescription } from '../../installation/types';

import { oldestValue, newestValue } from './field_utils';
import { oldestValue, newestValue, collectValues } from './field_utils';

export const getCommonFieldDescriptions = (ecsField: BaseECSEntityField): FieldDescription[] => {
return [
Expand Down Expand Up @@ -111,6 +111,18 @@ export const getEntityFieldsDescriptions = (rootField?: EntityType) => {
mapping: { type: 'boolean' },
allowAPIUpdate: true,
}),
collectValues({
source: `${prefix}.behaviors.Anomaly_job_ids`,
destination: 'entity.behaviors.Anomaly_job_ids',
mapping: { type: 'keyword' },
allowAPIUpdate: true,
}),
collectValues({
source: `${prefix}.behaviors.Rule_names`,
destination: 'entity.behaviors.Rule_names',
mapping: { type: 'keyword' },
allowAPIUpdate: true,
}),

newestValue({
source: `${prefix}.risk.calculated_level`,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ export default function (providerContext: FtrProviderContext) {
},
behaviors: {
brute_force_victim: true,
anomaly_job_ids: ['job-1'],
rule_names: ['rule-1'],
},
},
},
Expand All @@ -121,6 +123,8 @@ export default function (providerContext: FtrProviderContext) {
expect(hit._source?.entity?.id).toEqual(userName);
expect(hit._source?.entity?.attributes?.Privileged).toBeTruthy();
expect(hit._source?.entity?.behaviors?.Brute_force_victim).toBeTruthy();
expect(hit._source?.entity?.behaviors?.Anomaly_job_ids).toEqual(['job-1']);
expect(hit._source?.entity?.behaviors?.Rule_names).toEqual(['rule-1']);
});

return true;
Expand Down Expand Up @@ -154,6 +158,44 @@ export default function (providerContext: FtrProviderContext) {
expect(hit._source?.entity?.id).toEqual(userName);
expect(hit._source?.entity?.attributes?.Privileged).toBeTruthy();
expect(hit._source?.entity?.behaviors?.Brute_force_victim).toBeTruthy();
expect(hit._source?.entity?.behaviors?.Anomaly_job_ids).toEqual(['job-1']);
expect(hit._source?.entity?.behaviors?.Rule_names).toEqual(['rule-1']);
});
return true;
}
);

log.info('Calling upsert api to append more behavior values...');
const { statusCode: appendStatusCode } = await securitySolutionApi.upsertEntity({
params: {
entityType: 'user',
},
body: {
entity: {
id: userName,
behaviors: {
anomaly_job_ids: ['job-2', 'job-1'], // job-1 should not be duplicated
rule_names: ['rule-2'],
},
},
},
query: {},
});

expect(appendStatusCode).toEqual(200);

log.info('Verifying behavior values were appended without duplicates...');
await retry.waitForWithTimeout(
'Behavior values are appended',
LOCAL_TIMEOUT_MS,
async () => {
await assertEntityFromES(es, userName, USER_INDEX_NAME, (hit) => {
expect(hit._source?.entity?.behaviors?.Anomaly_job_ids).toHaveLength(2);
expect(hit._source?.entity?.behaviors?.Anomaly_job_ids).toContain('job-1');
expect(hit._source?.entity?.behaviors?.Anomaly_job_ids).toContain('job-2');
expect(hit._source?.entity?.behaviors?.Rule_names).toHaveLength(2);
expect(hit._source?.entity?.behaviors?.Rule_names).toContain('rule-1');
expect(hit._source?.entity?.behaviors?.Rule_names).toContain('rule-2');
});
return true;
}
Expand Down