Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate threat intel feeds #669

Merged
merged 39 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
12dd633
add mapping for indices storing threat intel feed data
eirsep Oct 2, 2023
a0fd6bd
fix feed indices mapping
eirsep Oct 2, 2023
d7ee565
add threat intel feed data dao
eirsep Oct 3, 2023
57c0faa
add threatIntelEnabled field in detector.
eirsep Oct 3, 2023
f0a8bed
add threat intel feed service and searching feeds
eirsep Oct 3, 2023
4594926
ti feed data to doc level query convertor logic added
eirsep Oct 3, 2023
f7ff940
plug threat intel feed into detector creation
eirsep Oct 4, 2023
c193773
Preliminary framework for jobscheduler and datasource (#626)
jowg-amazon Oct 5, 2023
2e52a02
create doc level query from threat intel feed data index docs"
eirsep Oct 7, 2023
1830ec9
handle threat intel enabled check during detector updation
eirsep Oct 9, 2023
dababa8
add tests for testing threat intel feed integration with detectors
eirsep Oct 10, 2023
5c733ed
Threat intel feeds job runner and unit tests (#654)
jowg-amazon Oct 10, 2023
4512308
converge job scheduler code with threat intel feed integration in det…
eirsep Oct 11, 2023
d1d7ca0
converge job scheduler and detector threat intel code
eirsep Oct 11, 2023
d53085b
add feed metadata config files in src and test
eirsep Oct 12, 2023
98bbd42
adds ioc fields list in log type config files and ioc fields object i…
eirsep Oct 12, 2023
decee51
fix compilation issues in tests
eirsep Oct 16, 2023
a79b8ac
test udpate detector disabling threat intel
eirsep Oct 17, 2023
2b59191
add tests for detector creation and updation with threat intel
eirsep Oct 17, 2023
f0f8270
Threat intel test (#673)
eirsep Oct 17, 2023
0bdd58b
fix threat intel integ tests and add update detector logic
eirsep Oct 17, 2023
0e89286
JS for Threat intel feeds - changed extension (#675)
jowg-amazon Oct 19, 2023
730b458
TIF Job Runner Cleanup (#676)
jowg-amazon Oct 20, 2023
7a24bd0
fix TIFJobParameter class
eirsep Oct 20, 2023
74a7440
test detector updation when feed updation job runs
eirsep Oct 20, 2023
4dd4190
removed delete job scheduler code and cleaned up (#678)
jowg-amazon Oct 20, 2023
a5136bf
working integ test (#680)
jowg-amazon Oct 20, 2023
24a7e51
fix timeout of tif job creation
eirsep Oct 21, 2023
31eebcb
remove unncessary thread forking in put tif job action
eirsep Oct 22, 2023
ae084e7
refactoring code to address review comments
eirsep Oct 22, 2023
28f3ba8
detector trigger detection types
eirsep Oct 20, 2023
2481466
pull out threat intel rest tests into separate test class
eirsep Oct 22, 2023
f2068f1
add detection types testing in detector trigger for rules and threat …
eirsep Oct 22, 2023
7225ee6
add license header
eirsep Oct 23, 2023
ae666de
add threat intel field aliases in mapping view response
eirsep Oct 23, 2023
040556c
fix threat intel feed parser
eirsep Oct 25, 2023
e850248
fix workflow failing test
eirsep Oct 25, 2023
2e88825
spotless check failures fixed
eirsep Oct 25, 2023
bed73ff
remove dockerfile (#689)
jowg-amazon Oct 25, 2023
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
32 changes: 20 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ opensearchplugin {
name 'opensearch-security-analytics'
description 'OpenSearch Security Analytics plugin'
classname 'org.opensearch.securityanalytics.SecurityAnalyticsPlugin'
extendedPlugins = ['opensearch-job-scheduler']
}

javaRestTest {
Expand Down Expand Up @@ -142,12 +143,6 @@ repositories {
sourceSets.main.java.srcDirs = ['src/main/generated','src/main/java']
configurations {
zipArchive

all {
resolutionStrategy {
force "com.google.guava:guava:32.0.1-jre"
}
}
}

dependencies {
Expand All @@ -158,17 +153,14 @@ dependencies {
api "org.opensearch:common-utils:${common_utils_version}@jar"
api "org.opensearch.client:opensearch-rest-client:${opensearch_version}"
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
compileOnly "org.opensearch:opensearch-job-scheduler-spi:${opensearch_build}"
implementation "org.apache.commons:commons-csv:1.10.0"
eirsep marked this conversation as resolved.
Show resolved Hide resolved

// Needed for integ tests
zipArchive group: 'org.opensearch.plugin', name:'alerting', version: "${opensearch_build}"
zipArchive group: 'org.opensearch.plugin', name:'opensearch-notifications-core', version: "${opensearch_build}"
zipArchive group: 'org.opensearch.plugin', name:'notifications', version: "${opensearch_build}"

//spotless
implementation('com.google.googlejavaformat:google-java-format:1.17.0') {
exclude group: 'com.google.guava'
}
implementation 'com.google.guava:guava:32.0.1-jre'
zipArchive group: 'org.opensearch.plugin', name:'opensearch-job-scheduler', version: "${opensearch_build}"
}

// RPM & Debian build
Expand Down Expand Up @@ -289,6 +281,22 @@ testClusters.integTest {
}
}
}))
plugin(provider({
new RegularFile() {
@Override
File getAsFile() {
return configurations.zipArchive.asFileTree.matching {
include '**/opensearch-job-scheduler*'
}.singleFile
}
}
}))
nodes.each { node ->
def plugins = node.plugins
def firstPlugin = plugins.get(0)
plugins.remove(0)
plugins.add(firstPlugin)
}
}

run {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
import java.util.Optional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.cluster.routing.Preference;
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.core.action.ActionListener;
import org.opensearch.action.ActionRequest;
import org.opensearch.core.action.ActionResponse;
import org.opensearch.action.search.SearchRequest;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.client.Client;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.node.DiscoveryNode;
Expand All @@ -38,18 +36,21 @@
import org.opensearch.index.codec.CodecServiceFactory;
import org.opensearch.index.engine.EngineFactory;
import org.opensearch.index.mapper.Mapper;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.indices.SystemIndexDescriptor;
import org.opensearch.jobscheduler.spi.JobSchedulerExtension;
import org.opensearch.jobscheduler.spi.ScheduledJobParser;
import org.opensearch.jobscheduler.spi.ScheduledJobRunner;
import org.opensearch.plugins.ActionPlugin;
import org.opensearch.plugins.ClusterPlugin;
import org.opensearch.plugins.EnginePlugin;
import org.opensearch.plugins.MapperPlugin;
import org.opensearch.plugins.Plugin;
import org.opensearch.plugins.SearchPlugin;
import org.opensearch.plugins.SystemIndexPlugin;
import org.opensearch.repositories.RepositoriesService;
import org.opensearch.rest.RestController;
import org.opensearch.rest.RestHandler;
import org.opensearch.script.ScriptService;
import org.opensearch.search.builder.SearchSourceBuilder;
import org.opensearch.securityanalytics.action.*;
import org.opensearch.securityanalytics.correlation.index.codec.CorrelationCodecService;
import org.opensearch.securityanalytics.correlation.index.mapper.CorrelationVectorFieldMapper;
Expand All @@ -60,7 +61,18 @@
import org.opensearch.securityanalytics.mapper.IndexTemplateManager;
import org.opensearch.securityanalytics.mapper.MapperService;
import org.opensearch.securityanalytics.model.CustomLogType;
import org.opensearch.securityanalytics.model.ThreatIntelFeedData;
import org.opensearch.securityanalytics.resthandler.*;
import org.opensearch.securityanalytics.threatIntel.DetectorThreatIntelService;
import org.opensearch.securityanalytics.threatIntel.ThreatIntelFeedDataService;
import org.opensearch.securityanalytics.threatIntel.action.PutTIFJobAction;
import org.opensearch.securityanalytics.threatIntel.action.TransportPutTIFJobAction;
import org.opensearch.securityanalytics.threatIntel.common.TIFLockService;
import org.opensearch.securityanalytics.threatIntel.feedMetadata.BuiltInTIFMetadataLoader;
import org.opensearch.securityanalytics.threatIntel.jobscheduler.TIFJobParameter;
import org.opensearch.securityanalytics.threatIntel.jobscheduler.TIFJobParameterService;
import org.opensearch.securityanalytics.threatIntel.jobscheduler.TIFJobRunner;
import org.opensearch.securityanalytics.threatIntel.jobscheduler.TIFJobUpdateService;
import org.opensearch.securityanalytics.transport.*;
import org.opensearch.securityanalytics.model.Rule;
import org.opensearch.securityanalytics.model.Detector;
Expand All @@ -75,7 +87,9 @@
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.watcher.ResourceWatcherService;

public class SecurityAnalyticsPlugin extends Plugin implements ActionPlugin, MapperPlugin, SearchPlugin, EnginePlugin, ClusterPlugin {
import static org.opensearch.securityanalytics.threatIntel.jobscheduler.TIFJobParameter.THREAT_INTEL_DATA_INDEX_NAME_PREFIX;

public class SecurityAnalyticsPlugin extends Plugin implements ActionPlugin, MapperPlugin, SearchPlugin, EnginePlugin, ClusterPlugin, SystemIndexPlugin, JobSchedulerExtension {

Check warning on line 92 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L92

Added line #L92 was not covered by tests

private static final Logger log = LogManager.getLogger(SecurityAnalyticsPlugin.class);

Expand All @@ -91,6 +105,8 @@
public static final String CORRELATION_RULES_BASE_URI = PLUGINS_BASE_URI + "/correlation/rules";

public static final String CUSTOM_LOG_TYPE_URI = PLUGINS_BASE_URI + "/logtype";
public static final String JOB_INDEX_NAME = ".opensearch-sap--job";
public static final Map<String, Object> TIF_JOB_INDEX_SETTING = Map.of(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1, IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, "0-all", IndexMetadata.SETTING_INDEX_HIDDEN, true);

private CorrelationRuleIndices correlationRuleIndices;

Expand All @@ -113,8 +129,12 @@
private BuiltinLogTypeLoader builtinLogTypeLoader;

private LogTypeService logTypeService;
@Override
public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings settings){
return Collections.singletonList(new SystemIndexDescriptor(THREAT_INTEL_DATA_INDEX_NAME_PREFIX, "System index used for threat intel data"));

Check warning on line 134 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L134

Added line #L134 was not covered by tests
}


private Client client;

@Override
public Collection<Object> createComponents(Client client,
Expand All @@ -128,7 +148,9 @@
NamedWriteableRegistry namedWriteableRegistry,
IndexNameExpressionResolver indexNameExpressionResolver,
Supplier<RepositoriesService> repositoriesServiceSupplier) {

builtinLogTypeLoader = new BuiltinLogTypeLoader();
BuiltInTIFMetadataLoader builtInTIFMetadataLoader = new BuiltInTIFMetadataLoader();

Check warning on line 153 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L153

Added line #L153 was not covered by tests
logTypeService = new LogTypeService(client, clusterService, xContentRegistry, builtinLogTypeLoader);
detectorIndices = new DetectorIndices(client.admin(), clusterService, threadPool);
ruleTopicIndices = new RuleTopicIndices(client, clusterService, logTypeService);
Expand All @@ -138,12 +160,18 @@
mapperService = new MapperService(client, clusterService, indexNameExpressionResolver, indexTemplateManager, logTypeService);
ruleIndices = new RuleIndices(logTypeService, client, clusterService, threadPool);
correlationRuleIndices = new CorrelationRuleIndices(client, clusterService);
this.client = client;
ThreatIntelFeedDataService threatIntelFeedDataService = new ThreatIntelFeedDataService(clusterService, client, indexNameExpressionResolver, xContentRegistry);
DetectorThreatIntelService detectorThreatIntelService = new DetectorThreatIntelService(threatIntelFeedDataService, client, xContentRegistry);
TIFJobParameterService tifJobParameterService = new TIFJobParameterService(client, clusterService);
TIFJobUpdateService tifJobUpdateService = new TIFJobUpdateService(clusterService, tifJobParameterService, threatIntelFeedDataService, builtInTIFMetadataLoader);
TIFLockService threatIntelLockService = new TIFLockService(clusterService, client);

Check warning on line 167 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L163-L167

Added lines #L163 - L167 were not covered by tests

TIFJobRunner.getJobRunnerInstance().initialize(clusterService, tifJobUpdateService, tifJobParameterService, threatIntelLockService, threadPool, detectorThreatIntelService);

Check warning on line 169 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L169

Added line #L169 was not covered by tests

return List.of(
detectorIndices, correlationIndices, correlationRuleIndices, ruleTopicIndices, customLogTypeIndices, ruleIndices,
mapperService, indexTemplateManager, builtinLogTypeLoader
);
mapperService, indexTemplateManager, builtinLogTypeLoader, builtInTIFMetadataLoader, threatIntelFeedDataService, detectorThreatIntelService,
tifJobUpdateService, tifJobParameterService, threatIntelLockService);
}

@Override
Expand Down Expand Up @@ -187,13 +215,34 @@
);
}

@Override
public String getJobType() {
return "opensearch_sap_job";

Check warning on line 220 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L220

Added line #L220 was not covered by tests
}

@Override
public String getJobIndex() {
return JOB_INDEX_NAME;

Check warning on line 225 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L225

Added line #L225 was not covered by tests
}

@Override
public ScheduledJobRunner getJobRunner() {
return TIFJobRunner.getJobRunnerInstance();

Check warning on line 230 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L230

Added line #L230 was not covered by tests
}

@Override
public ScheduledJobParser getJobParser() {
return (parser, id, jobDocVersion) -> TIFJobParameter.PARSER.parse(parser, null);

Check warning on line 235 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L235

Added line #L235 was not covered by tests
}

@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
return List.of(
Detector.XCONTENT_REGISTRY,
DetectorInput.XCONTENT_REGISTRY,
Rule.XCONTENT_REGISTRY,
CustomLogType.XCONTENT_REGISTRY
CustomLogType.XCONTENT_REGISTRY,
ThreatIntelFeedData.XCONTENT_REGISTRY
);
}

Expand Down Expand Up @@ -243,7 +292,10 @@
SecurityAnalyticsSettings.IS_CORRELATION_INDEX_SETTING,
SecurityAnalyticsSettings.CORRELATION_TIME_WINDOW,
SecurityAnalyticsSettings.DEFAULT_MAPPING_SCHEMA,
SecurityAnalyticsSettings.ENABLE_WORKFLOW_USAGE
SecurityAnalyticsSettings.ENABLE_WORKFLOW_USAGE,
SecurityAnalyticsSettings.TIF_UPDATE_INTERVAL,
SecurityAnalyticsSettings.BATCH_SIZE,
SecurityAnalyticsSettings.THREAT_INTEL_TIMEOUT
);
}

Expand Down Expand Up @@ -274,7 +326,8 @@
new ActionPlugin.ActionHandler<>(SearchCorrelationRuleAction.INSTANCE, TransportSearchCorrelationRuleAction.class),
new ActionHandler<>(IndexCustomLogTypeAction.INSTANCE, TransportIndexCustomLogTypeAction.class),
new ActionHandler<>(SearchCustomLogTypeAction.INSTANCE, TransportSearchCustomLogTypeAction.class),
new ActionHandler<>(DeleteCustomLogTypeAction.INSTANCE, TransportDeleteCustomLogTypeAction.class)
new ActionHandler<>(DeleteCustomLogTypeAction.INSTANCE, TransportDeleteCustomLogTypeAction.class),
new ActionHandler<>(PutTIFJobAction.INSTANCE, TransportPutTIFJobAction.class)
);
}

Expand All @@ -292,5 +345,5 @@
log.warn("Failed to initialize LogType config index and builtin log types");
}
});
}
}

Check warning on line 348 in src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/SecurityAnalyticsPlugin.java#L348

Added line #L348 was not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
.field(Detector.INPUTS_FIELD, detector.getInputs())
.field(Detector.LAST_UPDATE_TIME_FIELD, detector.getLastUpdateTime())
.field(Detector.ENABLED_TIME_FIELD, detector.getEnabledTime())
.field(Detector.THREAT_INTEL_ENABLED_FIELD, detector.getThreatIntelEnabled())

Check warning on line 71 in src/main/java/org/opensearch/securityanalytics/action/GetDetectorResponse.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/action/GetDetectorResponse.java#L71

Added line #L71 was not covered by tests
.endObject();
return builder.endObject();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,49 @@
*/
package org.opensearch.securityanalytics.action;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.action.ActionResponse;
import org.opensearch.core.common.Strings;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.core.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.common.io.stream.Writeable;
import org.opensearch.core.xcontent.ToXContentObject;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.securityanalytics.mapper.MapperUtils;
import org.opensearch.securityanalytics.model.LogType;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class GetMappingsViewResponse extends ActionResponse implements ToXContentObject {

public static final String UNMAPPED_INDEX_FIELDS = "unmapped_index_fields";
public static final String UNMAPPED_FIELD_ALIASES = "unmapped_field_aliases";
public static final String THREAT_INTEL_FIELD_ALIASES = "threat_intel_field_aliases";

private Map<String, Object> aliasMappings;
List<String> unmappedIndexFields;
List<String> unmappedFieldAliases;

/** This field sheds information on the list of field aliases that need to be mapped for a given IoC.
* For ex. one element for windows logtype would be
*{"ioc": "ip", "fields": ["destination.ip","source.ip"]} where "ip" is the IoC and the required field aliases to be mapped for
* threat intel based detection are "destination.ip","source.ip".*/
private List<LogType.IocFields> threatIntelFieldAliases;

public GetMappingsViewResponse(
Map<String, Object> aliasMappings,
List<String> unmappedIndexFields,
List<String> unmappedFieldAliases
List<String> unmappedFieldAliases,
List<LogType.IocFields> threatIntelFieldAliases
) {
this.aliasMappings = aliasMappings;
this.unmappedIndexFields = unmappedIndexFields;
this.unmappedFieldAliases = unmappedFieldAliases;
this.threatIntelFieldAliases = threatIntelFieldAliases;

Check warning on line 49 in src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java#L49

Added line #L49 was not covered by tests
}

public GetMappingsViewResponse(StreamInput in) throws IOException {
Expand All @@ -56,6 +68,7 @@
unmappedFieldAliases.add(in.readString());
}
}
this.threatIntelFieldAliases = in.readList(LogType.IocFields::readFrom);

Check warning on line 71 in src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java#L71

Added line #L71 was not covered by tests
}

@Override
Expand All @@ -82,6 +95,12 @@
} else {
out.writeVInt(0);
}
if(threatIntelFieldAliases!=null) {
out.writeBoolean(true);
out.writeCollection(threatIntelFieldAliases);

Check warning on line 100 in src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java#L99-L100

Added lines #L99 - L100 were not covered by tests
} else {
out.writeBoolean(false);

Check warning on line 102 in src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java#L102

Added line #L102 was not covered by tests
}
}

@Override
Expand All @@ -96,6 +115,9 @@
if (unmappedFieldAliases != null && unmappedFieldAliases.size() > 0) {
builder.field(UNMAPPED_FIELD_ALIASES, unmappedFieldAliases);
}
if(threatIntelFieldAliases != null && false == threatIntelFieldAliases.isEmpty()) {
builder.field(THREAT_INTEL_FIELD_ALIASES, threatIntelFieldAliases);

Check warning on line 119 in src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/action/GetMappingsViewResponse.java#L119

Added line #L119 was not covered by tests
}
return builder.endObject();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
.field(Detector.TRIGGERS_FIELD, detector.getTriggers())
.field(Detector.LAST_UPDATE_TIME_FIELD, detector.getLastUpdateTime())
.field(Detector.ENABLED_TIME_FIELD, detector.getEnabledTime())
.field(Detector.THREAT_INTEL_ENABLED_FIELD, detector.getThreatIntelEnabled())

Check warning on line 67 in src/main/java/org/opensearch/securityanalytics/action/IndexDetectorResponse.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/action/IndexDetectorResponse.java#L67

Added line #L67 was not covered by tests
.endObject();
return builder.endObject();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -660,6 +661,13 @@
return;
}

public List<LogType.IocFields> getIocFieldsList(String logType) {
LogType logTypeByName = builtinLogTypeLoader.getLogTypeByName(logType);

Check warning on line 665 in src/main/java/org/opensearch/securityanalytics/logtype/LogTypeService.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/logtype/LogTypeService.java#L665

Added line #L665 was not covered by tests
if(logTypeByName == null)
return Collections.emptyList();
return logTypeByName.getIocFieldsList();

Check warning on line 668 in src/main/java/org/opensearch/securityanalytics/logtype/LogTypeService.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/securityanalytics/logtype/LogTypeService.java#L667-L668

Added lines #L667 - L668 were not covered by tests
}

public void getRuleFieldMappingsAllSchemas(String logType, ActionListener<List<LogType.Mapping>> listener) {

if (builtinLogTypeLoader.logTypeExists(logType)) {
Expand Down
Loading
Loading