diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f0205f06..934d128c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,8 +99,9 @@ jobs: uses: actions/checkout@v4 - name: Setup Java ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: temurin java-version: ${{ matrix.java }} - name: Build and Test diff --git a/build.gradle b/build.gradle index e0e61127a..3453f7a0d 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ import org.opensearch.gradle.testclusters.OpenSearchCluster buildscript { ext { - opensearch_version = System.getProperty("opensearch.version", "3.6.0-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "3.7.0-SNAPSHOT") isSnapshot = "true" == System.getProperty("build.snapshot", "true") buildVersionQualifier = System.getProperty("build.version_qualifier", "") version_tokens = opensearch_version.tokenize('-') @@ -220,6 +220,19 @@ dependencies { // TODO remove once SA commons is published to maven central api files(sa_commons_file_path) + // Excluded from commons shadow jar to avoid jar hell with alerting plugin. + // Declared compileOnly: alerting provides them at runtime via extendedPlugins classloader sharing. + compileOnly 'com.fasterxml.jackson.core:jackson-databind:2.17.1' + compileOnly 'com.fasterxml.jackson.core:jackson-annotations:2.17.1' + compileOnly 'software.amazon.awssdk:sts:2.25.42' + compileOnly 'software.amazon.awssdk:sdk-core:2.25.42' + compileOnly 'software.amazon.awssdk:aws-core:2.25.42' + compileOnly 'software.amazon.awssdk:utils:2.25.42' + compileOnly 'software.amazon.awssdk:regions:2.25.42' + compileOnly 'software.amazon.awssdk:http-client-spi:2.25.42' + compileOnly 'software.amazon.awssdk:profiles:2.25.42' + compileOnly 'software.amazon.awssdk:annotations:2.25.42' + // 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}" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b11741a1a..ffc9416be 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=16f2b95838c1ddcf7242b1c39e7bbbb43c842f1f1a1a0dc4959b6d4d68abcac3 -distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-all.zip +distributionSha256Sum=708d2c6ecc97ca9a11838ef64a6c2301151b8dd10387e22dc1a12c30557cab5b +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/security-analytics-commons-1.0.0.jar b/security-analytics-commons-1.0.0.jar index aba98bfd6..21729479d 100644 Binary files a/security-analytics-commons-1.0.0.jar and b/security-analytics-commons-1.0.0.jar differ diff --git a/src/main/java/org/opensearch/securityanalytics/threatIntel/transport/monitor/TransportIndexThreatIntelMonitorAction.java b/src/main/java/org/opensearch/securityanalytics/threatIntel/transport/monitor/TransportIndexThreatIntelMonitorAction.java index 87871601e..e3f5780a0 100644 --- a/src/main/java/org/opensearch/securityanalytics/threatIntel/transport/monitor/TransportIndexThreatIntelMonitorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/threatIntel/transport/monitor/TransportIndexThreatIntelMonitorAction.java @@ -242,7 +242,9 @@ private Monitor buildThreatIntelMonitor(IndexThreatIntelMonitorRequest request) new DataSources(), false, null, - PLUGIN_OWNER_FIELD + PLUGIN_OWNER_FIELD, + null, + null ); } catch (Exception e) { String error = "Error occurred while parsing monitor."; diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java index 7dfaeac80..6f385e906 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java @@ -797,7 +797,7 @@ private IndexMonitorRequest createDocLevelMonitorRequest(List detector.getAlertsHistoryIndex(), detector.getAlertsHistoryIndexPattern(), DetectorMonitorConfig.getRuleIndexMappingsByType(), - true), enableDetectorWithDedicatedQueryIndices, null, PLUGIN_OWNER_FIELD); + true), enableDetectorWithDedicatedQueryIndices, null, PLUGIN_OWNER_FIELD, null, null); return new IndexMonitorRequest(monitorId, SequenceNumbers.UNASSIGNED_SEQ_NO, SequenceNumbers.UNASSIGNED_PRIMARY_TERM, refreshPolicy, restMethod, monitor, null); } @@ -903,7 +903,7 @@ private IndexMonitorRequest createDocLevelMonitorMatchAllRequest( detector.getAlertsHistoryIndex(), detector.getAlertsHistoryIndexPattern(), DetectorMonitorConfig.getRuleIndexMappingsByType(), - true), enableDetectorWithDedicatedQueryIndices, true, PLUGIN_OWNER_FIELD); + true), enableDetectorWithDedicatedQueryIndices, true, PLUGIN_OWNER_FIELD, null, null); return new IndexMonitorRequest(monitorId, SequenceNumbers.UNASSIGNED_SEQ_NO, SequenceNumbers.UNASSIGNED_PRIMARY_TERM, refreshPolicy, restMethod, monitor, null); } @@ -1079,7 +1079,7 @@ public void onResponse(GetIndexMappingsResponse getIndexMappingsResponse) { detector.getAlertsHistoryIndex(), detector.getAlertsHistoryIndexPattern(), DetectorMonitorConfig.getRuleIndexMappingsByType(), - true), false, null, PLUGIN_OWNER_FIELD); + true), false, null, PLUGIN_OWNER_FIELD, null, null); listener.onResponse(new IndexMonitorRequest(monitorId, SequenceNumbers.UNASSIGNED_SEQ_NO, SequenceNumbers.UNASSIGNED_PRIMARY_TERM, refreshPolicy, restMethod, monitor, null)); } diff --git a/src/test/java/org/opensearch/securityanalytics/alerts/AlertingServiceTests.java b/src/test/java/org/opensearch/securityanalytics/alerts/AlertingServiceTests.java index 39c235ce7..a001d88a9 100644 --- a/src/test/java/org/opensearch/securityanalytics/alerts/AlertingServiceTests.java +++ b/src/test/java/org/opensearch/securityanalytics/alerts/AlertingServiceTests.java @@ -97,7 +97,9 @@ public void testGetAlerts_success() { new DataSources(), true, null, - TransportIndexDetectorAction.PLUGIN_OWNER_FIELD + TransportIndexDetectorAction.PLUGIN_OWNER_FIELD, + null, + null ), new DocumentLevelTrigger("trigger_id_1", "my_trigger", "severity_low", List.of(), new Script("")), List.of("finding_id_1"), @@ -133,7 +135,9 @@ public void testGetAlerts_success() { new DataSources(), true, null, - TransportIndexDetectorAction.PLUGIN_OWNER_FIELD + TransportIndexDetectorAction.PLUGIN_OWNER_FIELD, + null, + null ), new DocumentLevelTrigger("trigger_id_1", "my_trigger", "severity_low", List.of(), new Script("")), List.of("finding_id_1"), diff --git a/src/test/java/org/opensearch/securityanalytics/threatIntel/model/monitor/ThreatIntelInputTests.java b/src/test/java/org/opensearch/securityanalytics/threatIntel/model/monitor/ThreatIntelInputTests.java index d56969de0..922a535ed 100644 --- a/src/test/java/org/opensearch/securityanalytics/threatIntel/model/monitor/ThreatIntelInputTests.java +++ b/src/test/java/org/opensearch/securityanalytics/threatIntel/model/monitor/ThreatIntelInputTests.java @@ -60,7 +60,9 @@ public void testThreatInputSerde() throws IOException { new DataSources(), false, null, - "security_analytics" + "security_analytics", + null, + null ); BytesStreamOutput monitorOut = new BytesStreamOutput(); monitor.writeTo(monitorOut);