Skip to content

Commit c06ba93

Browse files
Adding more comments and fixing alert type
1 parent 04a588b commit c06ba93

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

x-pack/plugins/security_solution/common/endpoint/models/event.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ describe('Generated documents', () => {
1919
it('returns the right name for a registry event', () => {
2020
const extensions = { registry: { key: `HKLM/Windows/Software/abc` } };
2121
const event = generator.generateEvent({ eventCategory: 'registry', extensions });
22+
// casting to ResolverEvent here because the `descriptiveName` function is used by the frontend is still relies
23+
// on the unsafe ResolverEvent type. Once it's switched over to the safe version we can remove this cast.
2224
expect(descriptiveName(event as ResolverEvent)).toEqual({
2325
subject: `HKLM/Windows/Software/abc`,
2426
});
@@ -28,6 +30,8 @@ describe('Generated documents', () => {
2830
const randomIP = `${generator.randomIP()}`;
2931
const extensions = { network: { direction: 'outbound', forwarded_ip: randomIP } };
3032
const event = generator.generateEvent({ eventCategory: 'network', extensions });
33+
// casting to ResolverEvent here because the `descriptiveName` function is used by the frontend is still relies
34+
// on the unsafe ResolverEvent type. Once it's switched over to the safe version we can remove this cast.
3135
expect(descriptiveName(event as ResolverEvent)).toEqual({
3236
subject: `${randomIP}`,
3337
descriptor: 'outbound',
@@ -37,6 +41,8 @@ describe('Generated documents', () => {
3741
it('returns the right name for a file event', () => {
3842
const extensions = { file: { path: 'C:\\My Documents\\business\\January\\processName' } };
3943
const event = generator.generateEvent({ eventCategory: 'file', extensions });
44+
// casting to ResolverEvent here because the `descriptiveName` function is used by the frontend is still relies
45+
// on the unsafe ResolverEvent type. Once it's switched over to the safe version we can remove this cast.
4046
expect(descriptiveName(event as ResolverEvent)).toEqual({
4147
subject: 'C:\\My Documents\\business\\January\\processName',
4248
});
@@ -45,6 +51,8 @@ describe('Generated documents', () => {
4551
it('returns the right name for a dns event', () => {
4652
const extensions = { dns: { question: { name: `${generator.randomIP()}` } } };
4753
const event = generator.generateEvent({ eventCategory: 'dns', extensions });
54+
// casting to ResolverEvent here because the `descriptiveName` function is used by the frontend is still relies
55+
// on the unsafe ResolverEvent type. Once it's switched over to the safe version we can remove this cast.
4856
expect(descriptiveName(event as ResolverEvent)).toEqual({
4957
subject: extensions.dns.question.name,
5058
});

x-pack/plugins/security_solution/common/endpoint/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,10 @@ export type AlertEvent = Partial<{
405405
process: Partial<{
406406
command_line: ECSField<string>;
407407
ppid: ECSField<number>;
408-
executable: ECSField<string>;
409408
start: ECSField<number>;
409+
// Using ECSField as the outer because the object is expected to be an array
410410
thread: ECSField<ThreadFields>;
411-
uptime: number;
411+
uptime: ECSField<number>;
412412
Ext: Partial<{
413413
// Using ECSField as the outer because the object is expected to be an array
414414
code_signature: ECSField<

0 commit comments

Comments
 (0)