Skip to content

Commit

Permalink
Merge branch 'main' into whitesource-remediate/guava-monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
owaiskazi19 authored Jan 15, 2025
2 parents 8035df8 + 5480cb4 commit 6d10485
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/test_security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
pull_request:
types: [opened, synchronize, reopened]

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
Expand All @@ -31,13 +29,16 @@ jobs:
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}

- name: Checkout Flow Framework
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ dependencies {
implementation "org.dafny:DafnyRuntime:4.9.0"
implementation "software.amazon.smithy.dafny:conversion:0.1.1"
implementation 'org.bouncycastle:bcprov-jdk18on:1.79'
api "org.apache.httpcomponents.core5:httpcore5:5.3.1"
api "org.apache.httpcomponents.core5:httpcore5:5.3.2"
implementation "jakarta.json.bind:jakarta.json.bind-api:3.0.1"
implementation "org.glassfish:jakarta.json:2.0.1"
implementation "org.eclipse:yasson:3.0.4"
Expand Down Expand Up @@ -210,7 +210,7 @@ dependencies {
resolutionStrategy {
force("com.google.guava:guava:33.4.0-jre") // CVE for 31.1, keep to force transitive dependencies
force("com.fasterxml.jackson.core:jackson-core:${jacksonVersion}") // Dependency Jar Hell
force("org.apache.httpcomponents.core5:httpcore5:5.3.1") // Dependency Jar Hell
force("org.apache.httpcomponents.core5:httpcore5:5.3.2") // Dependency Jar Hell
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import static org.opensearch.flowframework.common.WorkflowResources.CONNECTOR_ID;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.verify;

Expand Down Expand Up @@ -58,7 +59,7 @@ public void testDeleteConnector() throws IOException, ExecutionException, Interr
DeleteResponse output = new DeleteResponse(shardId, connectorIdArg, 1, 1, 1, true);
actionListener.onResponse(output);
return null;
}).when(machineLearningNodeClient).deleteConnector(any(String.class), any());
}).when(machineLearningNodeClient).deleteConnector(anyString(), anyActionListener());

PlainActionFuture<WorkflowData> future = deleteConnectorStep.execute(
inputData.getNodeId(),
Expand All @@ -67,7 +68,7 @@ public void testDeleteConnector() throws IOException, ExecutionException, Interr
Map.of("step_1", CONNECTOR_ID),
Collections.emptyMap()
);
verify(machineLearningNodeClient).deleteConnector(any(String.class), any());
verify(machineLearningNodeClient).deleteConnector(anyString(), anyActionListener());

assertTrue(future.isDone());
assertEquals(connectorId, future.get().getContent().get(CONNECTOR_ID));
Expand Down Expand Up @@ -97,7 +98,7 @@ public void testDeleteConnectorFailure() throws IOException {
ActionListener<DeleteResponse> actionListener = invocation.getArgument(1);
actionListener.onFailure(new FlowFrameworkException("Failed to delete connector", RestStatus.INTERNAL_SERVER_ERROR));
return null;
}).when(machineLearningNodeClient).deleteConnector(any(String.class), any());
}).when(machineLearningNodeClient).deleteConnector(anyString(), anyActionListener());

PlainActionFuture<WorkflowData> future = deleteConnectorStep.execute(
inputData.getNodeId(),
Expand All @@ -107,11 +108,16 @@ public void testDeleteConnectorFailure() throws IOException {
Collections.emptyMap()
);

verify(machineLearningNodeClient).deleteConnector(any(String.class), any());
verify(machineLearningNodeClient).deleteConnector(anyString(), anyActionListener());

assertTrue(future.isDone());
ExecutionException ex = assertThrows(ExecutionException.class, () -> future.get().getContent());
assertTrue(ex.getCause() instanceof FlowFrameworkException);
assertEquals("Failed to delete connector test", ex.getCause().getMessage());
}

@SuppressWarnings("unchecked")
private ActionListener<DeleteResponse> anyActionListener() {
return any(ActionListener.class);
}
}

0 comments on commit 6d10485

Please sign in to comment.