-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…14490) Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Esteban Beltran <[email protected]>
- Loading branch information
1 parent
6047f03
commit 50908d8
Showing
17 changed files
with
925 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { CreateExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; | ||
import { ENDPOINT_HOST_ISOLATION_EXCEPTIONS_LIST_ID } from '@kbn/securitysolution-list-constants'; | ||
import ipaddr from 'ipaddr.js'; | ||
|
||
export function createEmptyHostIsolationException(): CreateExceptionListItemSchema { | ||
return { | ||
comments: [], | ||
description: '', | ||
entries: [ | ||
{ | ||
field: 'destination.ip', | ||
operator: 'included', | ||
type: 'match', | ||
value: '', | ||
}, | ||
], | ||
item_id: undefined, | ||
list_id: ENDPOINT_HOST_ISOLATION_EXCEPTIONS_LIST_ID, | ||
name: '', | ||
namespace_type: 'agnostic', | ||
os_types: ['windows', 'linux', 'macos'], | ||
tags: ['policy:all'], | ||
type: 'simple', | ||
}; | ||
} | ||
|
||
export function isValidIPv4OrCIDR(maybeIp: string): boolean { | ||
try { | ||
ipaddr.IPv4.parseCIDR(maybeIp); | ||
return true; | ||
} catch (e) { | ||
return ipaddr.IPv4.isValid(maybeIp); | ||
} | ||
} |
Oops, something went wrong.