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

Add early rejection from RestHandler for unauthorized requests #3418

Merged
merged 120 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
6286f7f
[Draft] Resource usage case test
peternied Sep 27, 2023
ef660b1
Use DelegatingRestHandler to ensure that the original handler's imple…
cwperks Sep 27, 2023
cf327b5
Switch to create
cwperks Sep 28, 2023
a3bd919
Remove Sharable
cwperks Sep 29, 2023
b1343e1
Move Conditional Decompressor to core
cwperks Sep 29, 2023
ab693c6
Removed http channel
peternied Sep 29, 2023
6abd939
Add request source from the netty channel
peternied Sep 29, 2023
da8d0cb
Plumb SecurityRequest into HTTPAuthenticator interface
peternied Sep 29, 2023
26c6b83
Fix all tests
peternied Sep 29, 2023
7f6b364
Remove DelegatingRestHandler changes for now
cwperks Sep 29, 2023
a825d83
Prevent build break for generalized testing associated with SecurityR…
peternied Sep 29, 2023
095d4e5
Spotless
peternied Sep 29, 2023
6580e7f
Disable createHeaderVerifier so builds can pass
peternied Sep 29, 2023
7466271
Remove duplicated code
cwperks Sep 29, 2023
8c44278
Implement SecurityRequest gaps
peternied Sep 29, 2023
9b5fe42
Fix spotless
peternied Sep 29, 2023
9f369cb
Redo how reRequestAuthentication works
peternied Oct 1, 2023
46358a2
Nix that idea
peternied Oct 1, 2023
fa98ba9
Cleaning up some
peternied Oct 1, 2023
98c53ad
Run CI with respective branch in core
cwperks Oct 2, 2023
d9e5f4f
Run on push
cwperks Oct 2, 2023
eb33281
Correct branch
cwperks Oct 2, 2023
9844df9
Mild switch to RequestChannel
peternied Oct 2, 2023
ee54fbb
Same step
cwperks Oct 2, 2023
37a251b
Remove test
cwperks Oct 2, 2023
3b2925b
Remove should not happen
cwperks Oct 2, 2023
cafe1c7
Handle unsupported scenarios
peternied Oct 2, 2023
0829c94
Update audit log tests
cwperks Oct 2, 2023
2768a54
Merge branch 'improve-compressed-handling-gha' into improve-compresse…
cwperks Oct 2, 2023
b06242b
Update run
cwperks Oct 2, 2023
e46adaa
Use handlingSettings
cwperks Oct 2, 2023
e77adba
Skip decompression for WhoAmI and Health requests
cwperks Oct 2, 2023
2beb434
Tests compile again
peternied Oct 2, 2023
2ef4c3f
Fix spotless issues
peternied Oct 2, 2023
4970a49
Merge remote-tracking branch 'origin/main' into headerverifier
peternied Oct 2, 2023
87646d7
Fix merging from main changes
peternied Oct 2, 2023
aa5c0fc
Passthrough if sslOnly
cwperks Oct 3, 2023
868ec9b
Handle exception
cwperks Oct 3, 2023
547218b
Restore default build.gradle settings
peternied Oct 3, 2023
d44d277
Fix bug in authn/z stages of handler wrapper
peternied Oct 3, 2023
b960aac
Focus channel implementation
peternied Oct 3, 2023
4d9506c
Merge remote-tracking branch 'origin/main' into headerverifier
peternied Oct 3, 2023
3111665
Fix merge conflict related issues
peternied Oct 3, 2023
c1ae22f
Fix SystemIntegratorsTests
cwperks Oct 3, 2023
2aad250
Seperate read-only vs read-write scenarios
peternied Oct 3, 2023
9a915e7
Spotless
peternied Oct 3, 2023
e749a8e
more cleanup
peternied Oct 3, 2023
20c9ea7
Rename concrete classes
peternied Oct 3, 2023
22991e3
Maybe final changes batch
peternied Oct 3, 2023
6f959ae
Use SSLConfig class
cwperks Oct 3, 2023
caf433a
Merge branch 'main' into improve-compressed-handling
cwperks Oct 3, 2023
828ef2b
Fix parameter consumption
peternied Oct 3, 2023
641c195
Fix incorrect error message
peternied Oct 3, 2023
74a925d
javadoc
peternied Oct 3, 2023
e5d4235
Handle special case of api/authtoken
cwperks Oct 4, 2023
e5452a2
Use FakeRestRequest
cwperks Oct 4, 2023
e001924
Use AttributeKeys in SecurityRestFilter just in time
cwperks Oct 4, 2023
21e1030
Remove the Authenticatiion verifier
peternied Oct 3, 2023
09207c2
Debug statement
peternied Oct 4, 2023
659088d
Even more logging
peternied Oct 4, 2023
c019f02
Even more loogging
peternied Oct 4, 2023
e8e5155
Even more logging
peternied Oct 4, 2023
9ffa147
Add more logging
peternied Oct 4, 2023
613acab
move logging location
peternied Oct 4, 2023
2125f9f
Refactor to optional in progress
peternied Oct 4, 2023
edbe2be
Restore changes around passing unsent response
peternied Oct 4, 2023
33aa863
revert logging changes
peternied Oct 4, 2023
0c5a97d
Fix spotless
peternied Oct 4, 2023
2f58523
Fix exception name
peternied Oct 4, 2023
5dc3033
Copyright headers
peternied Oct 4, 2023
e323823
PR comments
peternied Oct 4, 2023
b77e678
Check channel type
cwperks Oct 4, 2023
177ad11
Fix issue with saml tests
peternied Oct 5, 2023
1312d2c
Fine tunning cr pass
peternied Oct 5, 2023
34d33ca
Fix TaskTests with X-Opaque-ID
cwperks Oct 5, 2023
28f620b
Fix bad auth realm
peternied Oct 5, 2023
38c34cb
Fix build break
peternied Oct 5, 2023
6a1e067
Merge branch 'main' into improve-compressed-handling
cwperks Oct 5, 2023
3409e81
Merge branch 'headerverifier' into improve-compressed-handling-securi…
cwperks Oct 5, 2023
27f49d8
Use createRestRequest
cwperks Oct 5, 2023
4d487fa
Check if exists, then set
cwperks Oct 5, 2023
a9bf8b9
Merge branch 'improve-compressed-handling' of https://github.com/cwpe…
cwperks Oct 5, 2023
6b68dc8
X-Opaque-Id
cwperks Oct 5, 2023
93ca9ab
Single netty request class
cwperks Oct 5, 2023
bd96a33
Get value from transport constructor
cwperks Oct 5, 2023
be5d5e5
Minimize core changes
cwperks Oct 5, 2023
000e9d5
minor update
cwperks Oct 5, 2023
8e78d66
Merge branch 'improve-compressed-handling-security-request' into impr…
cwperks Oct 5, 2023
2e45460
Remove unused import
cwperks Oct 5, 2023
0906b4e
Merge remote-tracking branch 'origin/main' into HEAD
peternied Oct 6, 2023
8554082
Cleaning up more logic around attributes
peternied Oct 6, 2023
a013e04
Remove outdated test files
peternied Oct 6, 2023
9bb86cb
Remove from SecurityRequestChannel
peternied Oct 6, 2023
0465436
Fix test compile issue
peternied Oct 6, 2023
062ee96
Rollback changes that aren't required
peternied Oct 6, 2023
71185b0
Cleanup spotless and some other routdated eferences
peternied Oct 6, 2023
a2d69b5
Don't create new attribute for the http-channel
peternied Oct 6, 2023
c058350
Iterating forward
peternied Oct 6, 2023
297fa0d
Merge branch 'opensearch-project:main' into improve-compressed-handling
cwperks Oct 6, 2023
23cfbb6
Remove code that should not be commented out
peternied Oct 6, 2023
782d27f
Merge remote-tracking branch 'cwperks/improve-compressed-handling' in…
peternied Oct 6, 2023
4abc12e
Only set X-Opaque-Id if present
cwperks Oct 6, 2023
77a5182
Fix checkstyle
cwperks Oct 6, 2023
1773227
Switch peekFrom to use get instead of getAndSet
cwperks Oct 6, 2023
678fc0e
Clear attributes with early response
cwperks Oct 6, 2023
2df5bd7
Update skip logic and NettyRequest.path
cwperks Oct 6, 2023
e7df5d2
Merge branch 'resource-tester' into improve-compressed-handling
peternied Oct 6, 2023
146a114
Catch IllegalArgumentException in request.path
cwperks Oct 6, 2023
f0350f2
Match RestRequest implementation of path
cwperks Oct 6, 2023
6cdedbe
Handle case of NettyRequest
cwperks Oct 6, 2023
cce6722
Remove requestFromNetty
cwperks Oct 6, 2023
1d6d96d
Add some tests
peternied Oct 6, 2023
b891098
Sharable channel handlers
peternied Oct 6, 2023
52f7844
Merge commit 'cwperks/improve-compressed-handling' into improve-compr…
peternied Oct 6, 2023
cae4149
Filter tests to only run integration test case
peternied Oct 6, 2023
799d648
updates to CI systems
peternied Oct 6, 2023
033d59f
Make sure resource tests can fail
peternied Oct 6, 2023
6b4b5c4
Only conditionally apply retries no integrationTests
peternied Oct 6, 2023
99c029f
Remove out of date comments
peternied Oct 6, 2023
308645c
Fix spotless issues
peternied Oct 6, 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
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
GRADLE_OPTS: -Dhttp.keepAlive=false
CI_ENVIRONMENT: normal

jobs:
generate-test-list:
Expand Down Expand Up @@ -108,6 +109,32 @@ jobs:
arguments: |
integrationTest -Dbuild.snapshot=false

resource-tests:
env:
CI_ENVIRONMENT: resource-test
strategy:
fail-fast: false
matrix:
jdk: [17]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}

steps:
- name: Set up JDK for build and test
uses: actions/setup-java@v3
with:
distribution: temurin # Temurin is a distribution of adoptium
java-version: ${{ matrix.jdk }}

- name: Checkout security
uses: actions/checkout@v4

- name: Build and Test
uses: gradle/gradle-build-action@v2
with:
cache-disabled: true
arguments: |
integrationTest -Dbuild.snapshot=false --tests org.opensearch.security.ResourceFocusedTests
backward-compatibility-build:
runs-on: ubuntu-latest
steps:
Expand Down
21 changes: 16 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -459,16 +459,27 @@ sourceSets {

//add new task that runs integration tests
task integrationTest(type: Test) {
doFirst {
// Only run resources tests on resource-test CI environments or locally
if (System.getenv('CI_ENVIRONMENT') == 'resource-test' || System.getenv('CI_ENVIRONMENT') == null) {
include '**/ResourceFocusedTests.class'
} else {
exclude '**/ResourceFocusedTests.class'
}
// Only run with retries while in CI systems
if (System.getenv('CI_ENVIRONMENT') == 'normal') {
retry {
failOnPassedAfterRetry = false
maxRetries = 2
maxFailures = 10
}
}
}
description = 'Run integration tests.'
group = 'verification'
systemProperty "java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager"
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
retry {
failOnPassedAfterRetry = false
maxRetries = 2
maxFailures = 10
}
//run the integrationTest task after the test task
shouldRunAfter test
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
package org.opensearch.security;

import static org.opensearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
import static org.opensearch.test.framework.TestSecurityConfig.AuthcDomain.AUTHC_HTTPBASIC_INTERNAL;
import static org.opensearch.test.framework.TestSecurityConfig.Role.ALL_ACCESS;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.zip.GZIPOutputStream;

import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
import org.apache.hc.core5.http.message.BasicHeader;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.opensearch.action.index.IndexRequest;
import org.opensearch.client.Client;
import org.opensearch.test.framework.TestSecurityConfig;
import org.opensearch.test.framework.TestSecurityConfig.User;
import org.opensearch.test.framework.cluster.ClusterManager;
import org.opensearch.test.framework.cluster.LocalCluster;
import org.opensearch.test.framework.cluster.TestRestClient;

import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;

@RunWith(com.carrotsearch.randomizedtesting.RandomizedRunner.class)
@ThreadLeakScope(ThreadLeakScope.Scope.NONE)
public class ResourceFocusedTests {
private static final User ADMIN_USER = new User("admin").roles(ALL_ACCESS);
private static final User LIMITED_USER = new User("limited_user").roles(
new TestSecurityConfig.Role("limited-role").clusterPermissions(
"indices:data/read/mget",
"indices:data/read/msearch",
"indices:data/read/scroll",
"cluster:monitor/state",
"cluster:monitor/health"
)
.indexPermissions(
"indices:data/read/search",
"indices:data/read/mget*",
"indices:monitor/settings/get",
"indices:monitor/stats"
)
.on("*")
);

@ClassRule
public static LocalCluster cluster = new LocalCluster.Builder().clusterManager(ClusterManager.THREE_CLUSTER_MANAGERS)
.authc(AUTHC_HTTPBASIC_INTERNAL)
.users(ADMIN_USER, LIMITED_USER)
.anonymousAuth(false)
.doNotFailOnForbidden(true)
.build();

@BeforeClass
public static void createTestData() {
try (Client client = cluster.getInternalNodeClient()) {
client.index(new IndexRequest().setRefreshPolicy(IMMEDIATE).index("document").source(Map.of("foo", "bar", "abc", "xyz")))
.actionGet();
}
}

@Test
public void testUnauthenticatedFewBig() {
// Tweaks:
final RequestBodySize size = RequestBodySize.XLarge;
final String requestPath = "/*/_search";
final int parrallelism = 5;
final int totalNumberOfRequests = 100;
final boolean statsPrinter = false;

runResourceTest(size, requestPath, parrallelism, totalNumberOfRequests, statsPrinter);
}

@Test
public void testUnauthenticatedManyMedium() {
// Tweaks:
final RequestBodySize size = RequestBodySize.Medium;
final String requestPath = "/*/_search";
final int parrallelism = 20;
final int totalNumberOfRequests = 10_000;
final boolean statsPrinter = false;

runResourceTest(size, requestPath, parrallelism, totalNumberOfRequests, statsPrinter);
}

@Test
public void testUnauthenticatedTonsSmall() {
// Tweaks:
final RequestBodySize size = RequestBodySize.Small;
final String requestPath = "/*/_search";
final int parrallelism = 100;
final int totalNumberOfRequests = 1_000_000;
final boolean statsPrinter = false;

runResourceTest(size, requestPath, parrallelism, totalNumberOfRequests, statsPrinter);
}

private Long runResourceTest(
final RequestBodySize size,
final String requestPath,
final int parrallelism,
final int totalNumberOfRequests,
final boolean statsPrinter
) {
final byte[] compressedRequestBody = createCompressedRequestBody(size);
try (final TestRestClient client = cluster.getRestClient(new BasicHeader("Content-Encoding", "gzip"))) {

if (statsPrinter) {
printStats();
}
final HttpPost post = new HttpPost(client.getHttpServerUri() + requestPath);
post.setEntity(new ByteArrayEntity(compressedRequestBody, ContentType.APPLICATION_JSON));

final ForkJoinPool forkJoinPool = new ForkJoinPool(parrallelism);

final List<CompletableFuture<Void>> waitingOn = IntStream.rangeClosed(1, totalNumberOfRequests)
.boxed()
.map(i -> CompletableFuture.runAsync(() -> client.executeRequest(post), forkJoinPool))
.collect(Collectors.toList());
Supplier<Long> getCount = () -> waitingOn.stream().filter(cf -> cf.isDone() && !cf.isCompletedExceptionally()).count();

CompletableFuture<Void> statPrinter = statsPrinter ? CompletableFuture.runAsync(() -> {
while (true) {
printStats();
System.out.println(" & Succesful completions: " + getCount.get());
try {
Thread.sleep(500);
} catch (Exception e) {
break;
}
}
}, forkJoinPool) : CompletableFuture.completedFuture(null);

final CompletableFuture<Void> allOfThem = CompletableFuture.allOf(waitingOn.toArray(new CompletableFuture[0]));

try {
allOfThem.get(30, TimeUnit.SECONDS);
statPrinter.cancel(true);
} catch (final Exception e) {
// Ignored
}

if (statsPrinter) {
printStats();
System.out.println(" & Succesful completions: " + getCount.get());
}
return getCount.get();
}
}

static enum RequestBodySize {
Small(1),
Medium(1_000),
XLarge(1_000_000);

public final int elementCount;

private RequestBodySize(final int elementCount) {
this.elementCount = elementCount;
}
}

private byte[] createCompressedRequestBody(final RequestBodySize size) {
final int repeatCount = size.elementCount;
final String prefix = "{ \"items\": [";
final String repeatedElement = IntStream.range(0, 20)
.mapToObj(n -> ('a' + n) + "")
.map(n -> '"' + n + '"' + ": 123")
.collect(Collectors.joining(",", "{", "}"));
final String postfix = "]}";
long uncompressedBytesSize = 0;

try (
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream)
) {

final byte[] prefixBytes = prefix.getBytes(StandardCharsets.UTF_8);
final byte[] repeatedElementBytes = repeatedElement.getBytes(StandardCharsets.UTF_8);
final byte[] postfixBytes = postfix.getBytes(StandardCharsets.UTF_8);

gzipOutputStream.write(prefixBytes);
uncompressedBytesSize = uncompressedBytesSize + prefixBytes.length;
for (int i = 0; i < repeatCount; i++) {
gzipOutputStream.write(repeatedElementBytes);
uncompressedBytesSize = uncompressedBytesSize + repeatedElementBytes.length;
}
gzipOutputStream.write(postfixBytes);
uncompressedBytesSize = uncompressedBytesSize + postfixBytes.length;
gzipOutputStream.finish();

final byte[] compressedRequestBody = byteArrayOutputStream.toByteArray();
System.out.println(
"^^^"
+ String.format(
"Original size was %,d bytes, compressed to %,d bytes, ratio %,.2f",
uncompressedBytesSize,
compressedRequestBody.length,
((double) uncompressedBytesSize / compressedRequestBody.length)
)
);
return compressedRequestBody;
} catch (final IOException ioe) {
throw new RuntimeException(ioe);
}
}

private void printStats() {
System.out.println("** Stats ");
printMemory();
printMemoryPools();
printGCPools();
}

private void printMemory() {
final Runtime runtime = Runtime.getRuntime();

final long totalMemory = runtime.totalMemory(); // Total allocated memory
final long freeMemory = runtime.freeMemory(); // Amount of free memory
final long usedMemory = totalMemory - freeMemory; // Amount of used memory

System.out.println(" Memory Total: " + totalMemory + " Free:" + freeMemory + " Used:" + usedMemory);
}

private void printMemoryPools() {
List<MemoryPoolMXBean> memoryPools = ManagementFactory.getMemoryPoolMXBeans();
for (MemoryPoolMXBean memoryPool : memoryPools) {
MemoryUsage usage = memoryPool.getUsage();
System.out.println(" " + memoryPool.getName() + " USED: " + usage.getUsed() + " MAX: " + usage.getMax());
}
}

private void printGCPools() {
List<GarbageCollectorMXBean> garbageCollectors = ManagementFactory.getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean garbageCollector : garbageCollectors) {
System.out.println(" " + garbageCollector.getName() + " COLLECTION TIME: " + garbageCollector.getCollectionTime());
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void createRoleMapping(String backendRoleName, String roleName) {
response.assertStatusCode(201);
}

protected final String getHttpServerUri() {
public final String getHttpServerUri() {
return "http" + (enableHTTPClientSSL ? "s" : "") + "://" + nodeHttpAddress.getHostString() + ":" + nodeHttpAddress.getPort();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
public static final String IDP_METADATA_FILE = "idp.metadata_file";
public static final String IDP_METADATA_CONTENT = "idp.metadata_content";

private static final String API_AUTHTOKEN_SUFFIX = "api/authtoken";
public static final String API_AUTHTOKEN_SUFFIX = "api/authtoken";
private static final String AUTHINFO_SUFFIX = "authinfo";
private static final String REGEX_PATH_PREFIX = "/(" + LEGACY_OPENDISTRO_PREFIX + "|" + PLUGINS_PREFIX + ")/" + "(.*)";
private static final Pattern PATTERN_PATH_PREFIX = Pattern.compile(REGEX_PATH_PREFIX);
Expand Down Expand Up @@ -155,16 +155,16 @@
@Override
public AuthCredentials extractCredentials(final SecurityRequest request, final ThreadContext threadContext)
throws OpenSearchSecurityException {
Matcher matcher = PATTERN_PATH_PREFIX.matcher(request.path());

Check warning on line 158 in src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java#L158

Added line #L158 was not covered by tests
final String suffix = matcher.matches() ? matcher.group(2) : null;
if (API_AUTHTOKEN_SUFFIX.equals(suffix)) {
return null;
}

AuthCredentials authCredentials = this.httpJwtAuthenticator.extractCredentials(request, threadContext);

Check warning on line 164 in src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java#L164

Added line #L164 was not covered by tests

if (AUTHINFO_SUFFIX.equals(suffix)) {
this.initLogoutUrl(threadContext, authCredentials);

Check warning on line 167 in src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java#L167

Added line #L167 was not covered by tests
}

return authCredentials;
Expand All @@ -184,7 +184,7 @@
if (API_AUTHTOKEN_SUFFIX.equals(suffix)) {
// Verficiation of SAML ASC endpoint only works with RestRequests
if (!(request instanceof OpenSearchRequest)) {
throw new SecurityRequestChannelUnsupported();

Check warning on line 187 in src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticator.java#L187

Added line #L187 was not covered by tests
} else {
final OpenSearchRequest openSearchRequest = (OpenSearchRequest) request;
final RestRequest restRequest = openSearchRequest.breakEncapsulationForRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ public final class OpenSearchSecurityPlugin extends OpenSearchSecuritySSLPlugin
public static final String PLUGINS_PREFIX = "_plugins/_security";

private boolean sslCertReloadEnabled;
private volatile SecurityRestFilter securityRestHandler;
private volatile SecurityInterceptor si;
private volatile PrivilegesEvaluator evaluator;
private volatile UserService userService;
Expand Down Expand Up @@ -914,7 +913,8 @@ public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
validatingDispatcher,
clusterSettings,
sharedGroupFactory,
tracer
tracer,
securityRestHandler
);

return Collections.singletonMap("org.opensearch.security.http.SecurityHttpServerTransport", () -> odshst);
Expand All @@ -930,7 +930,8 @@ public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
dispatcher,
clusterSettings,
sharedGroupFactory,
tracer
tracer,
securityRestHandler
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.ssl.SSLContextBuilder;
import org.apache.hc.core5.ssl.TrustStrategy;

import org.apache.http.HttpStatus;
import org.opensearch.common.settings.Settings;
import org.opensearch.core.common.Strings;
import org.opensearch.security.auditlog.impl.AuditMessage;
Expand Down
Loading
Loading