diff --git a/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetails.tsx b/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetails.tsx index a62a7437..9525e448 100644 --- a/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetails.tsx +++ b/public/pages/ThreatIntel/components/ThreatIntelSourceDetails/ThreatIntelSourceDetails.tsx @@ -27,6 +27,7 @@ import { ThreatIntelS3CustomSourcePayload, ThreatIntelSourceItem, ThreatIntelSourcePayload, + URLDownloadSource, } from '../../../../../types'; import { defaultIntervalUnitOptions } from '../../../../utils/constants'; import { readIocsFromFile, threatIntelSourceItemToBasePayload } from '../../utils/helpers'; @@ -331,6 +332,14 @@ export const ThreatIntelSourceDetails: React.FC = )} )} + {type === 'URL_DOWNLOAD' && ( + + + + )} <> @@ -344,14 +353,16 @@ export const ThreatIntelSourceDetails: React.FC = - - setIsReadOnly(false)} - > - Edit - - + {type !== 'URL_DOWNLOAD' && ( + + setIsReadOnly(false)} + > + Edit + + + )} {!isReadOnly && ( diff --git a/public/pages/ThreatIntel/containers/Overview/ThreatIntelOverview.tsx b/public/pages/ThreatIntel/containers/Overview/ThreatIntelOverview.tsx index dc9d7c16..7b000aa9 100644 --- a/public/pages/ThreatIntel/containers/Overview/ThreatIntelOverview.tsx +++ b/public/pages/ThreatIntel/containers/Overview/ThreatIntelOverview.tsx @@ -194,7 +194,7 @@ export const ThreatIntelOverview: React.FC = ({ initialIsOpen={threatIntelSources.length === 0 || logSources.length === 0} > - + {threatIntelNextStepsProps.map( ({ id, title, description, footerButtonProps: { text, disabled } }) => ( diff --git a/public/pages/ThreatIntel/containers/ThreatIntelSource/ThreatIntelSource.tsx b/public/pages/ThreatIntel/containers/ThreatIntelSource/ThreatIntelSource.tsx index d4d630f5..64d767a2 100644 --- a/public/pages/ThreatIntel/containers/ThreatIntelSource/ThreatIntelSource.tsx +++ b/public/pages/ThreatIntel/containers/ThreatIntelSource/ThreatIntelSource.tsx @@ -11,14 +11,17 @@ import { useEffect } from 'react'; import { CoreServicesContext } from '../../../../components/core_services'; import { EuiButton, + EuiButtonIcon, EuiFlexGroup, EuiFlexItem, + EuiIcon, EuiLoadingContent, EuiPanel, EuiSpacer, EuiTabbedContent, EuiTabbedContentTab, EuiTitle, + EuiToolTip, } from '@elastic/eui'; import { DescriptionGroup } from '../../../../components/Utility/DescriptionGroup'; import { IoCsTable } from '../../components/IoCsTable/IoCsTable'; @@ -138,7 +141,25 @@ export const ThreatIntelSource: React.FC = ({ } }; - const { name, description, type, ioc_types, last_update_time, enabled } = source; + const toggleActiveState = async () => { + const updateRes = await threatIntelService.updateThreatIntelSource(source.id, { + ...source, + enabled_for_scan: !source.enabled_for_scan, + }); + if (updateRes.ok) { + onSourceUpdate(); + } + }; + + const { + name, + description, + type, + ioc_types, + last_update_time, + enabled, + enabled_for_scan, + } = source; const schedule = type === 'S3_CUSTOM' ? source.schedule : undefined; return ( @@ -150,7 +171,32 @@ export const ThreatIntelSource: React.FC = ({ - + + + + + {' '} + {enabled_for_scan ? 'Active' : 'Inactive'}  + + + + + + + {enabled_for_scan ? 'Deactivate' : 'Activate'} + + {type === 'S3_CUSTOM' && ( @@ -159,9 +205,9 @@ export const ThreatIntelSource: React.FC = ({ )} - - Delete - + + + diff --git a/types/ThreatIntel.ts b/types/ThreatIntel.ts index 2af79390..3367cb18 100644 --- a/types/ThreatIntel.ts +++ b/types/ThreatIntel.ts @@ -52,12 +52,19 @@ export interface FileUploadSource { }; } +export interface URLDownloadSource { + url_download: { + url: string; + }; +} + export interface ThreatIntelSourcePayloadBase { name: string; description?: string; format: 'STIX2'; store_type: 'OS'; enabled: boolean; + enabled_for_scan: boolean; ioc_types: ThreatIntelIocType[]; } @@ -78,9 +85,22 @@ export interface ThreatIntelIocUploadSourcePayload extends ThreatIntelSourcePayl source: FileUploadSource; } +export interface ThreatIntelURLDownloadSourceInfo extends ThreatIntelSourcePayloadBase { + type: 'URL_DOWNLOAD'; + schedule: { + interval: { + start_time: number; + period: number; + unit: string; + }; + }; + source: URLDownloadSource; +} + export type ThreatIntelSourcePayload = | ThreatIntelS3CustomSourcePayload - | ThreatIntelIocUploadSourcePayload; + | ThreatIntelIocUploadSourcePayload + | ThreatIntelURLDownloadSourceInfo; export interface LogSourceIocConfig { enabled: boolean;