From a7458bdf9203919fe138d913d5b52c5f5a4925f2 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Thu, 3 Oct 2024 14:49:11 -0400 Subject: [PATCH] Rename files + test Signed-off-by: Derek Ho --- .../org/opensearch/security/SystemIndexTests.java | 2 +- .../resources/log4j2-test.properties | 2 +- .../security/OpenSearchSecurityPlugin.java | 13 ++----------- ...r.java => SystemFlsDlsIndexSearcherWrapper.java} | 4 ++-- ...Wrapper.java => SystemIndexSearcherWrapper.java} | 4 ++-- 5 files changed, 8 insertions(+), 17 deletions(-) rename src/main/java/org/opensearch/security/configuration/{SecurityFlsDlsIndexSearcherWrapper.java => SystemFlsDlsIndexSearcherWrapper.java} (98%) rename src/main/java/org/opensearch/security/configuration/{SecurityIndexSearcherWrapper.java => SystemIndexSearcherWrapper.java} (98%) diff --git a/src/integrationTest/java/org/opensearch/security/SystemIndexTests.java b/src/integrationTest/java/org/opensearch/security/SystemIndexTests.java index bf96b2e433..02f261229c 100644 --- a/src/integrationTest/java/org/opensearch/security/SystemIndexTests.java +++ b/src/integrationTest/java/org/opensearch/security/SystemIndexTests.java @@ -82,7 +82,7 @@ public void adminShouldNotBeAbleToDeleteSecurityIndex() { } @Test - public void adminShouldNotBeAbleToReadSecurityIndex() { + public void adminShouldNotBeAbleToReadSystemIndex() { // Create system index and index a dummy document as the super admin user, data returned to super admin try (TestRestClient client = cluster.getRestClient(cluster.getAdminCertificate())) { HttpResponse response1 = client.put(".system-index1"); diff --git a/src/integrationTest/resources/log4j2-test.properties b/src/integrationTest/resources/log4j2-test.properties index ee1bd5b455..05aef04bdc 100644 --- a/src/integrationTest/resources/log4j2-test.properties +++ b/src/integrationTest/resources/log4j2-test.properties @@ -30,7 +30,7 @@ logger.httpjwtauthenticator.name = com.amazon.dlic.auth.http.jwt.HTTPJwtAuthenti logger.httpjwtauthenticator.level = debug logger.httpjwtauthenticator.appenderRef.capturing.ref = logCapturingAppender -logger.securityflsdlsindexsearcherwrapper.name = org.opensearch.security.configuration.SecurityFlsDlsIndexSearcherWrapper +logger.securityflsdlsindexsearcherwrapper.name = org.opensearch.security.configuration.SystemFlsDlsIndexSearcherWrapper logger.securityflsdlsindexsearcherwrapper.level = debug logger.securityflsdlsindexsearcherwrapper.appenderRef.capturing.ref = logCapturingAppender diff --git a/src/main/java/org/opensearch/security/OpenSearchSecurityPlugin.java b/src/main/java/org/opensearch/security/OpenSearchSecurityPlugin.java index 594af15f03..bbc13d1419 100644 --- a/src/main/java/org/opensearch/security/OpenSearchSecurityPlugin.java +++ b/src/main/java/org/opensearch/security/OpenSearchSecurityPlugin.java @@ -154,7 +154,7 @@ import org.opensearch.security.configuration.DlsFlsValveImpl; import org.opensearch.security.configuration.PrivilegesInterceptorImpl; import org.opensearch.security.configuration.Salt; -import org.opensearch.security.configuration.SecurityFlsDlsIndexSearcherWrapper; +import org.opensearch.security.configuration.SystemFlsDlsIndexSearcherWrapper; import org.opensearch.security.dlic.rest.api.Endpoint; import org.opensearch.security.dlic.rest.api.SecurityRestApiActions; import org.opensearch.security.dlic.rest.api.ssl.CertificatesActionType; @@ -696,16 +696,7 @@ public void onIndexModule(IndexModule indexModule) { indexModule.addIndexOperationListener(ciol); indexModule.setReaderWrapper( - indexService -> new SecurityFlsDlsIndexSearcherWrapper( - indexService, - settings, - adminDns, - cs, - auditLog, - ciol, - evaluator, - salt - ) + indexService -> new SystemFlsDlsIndexSearcherWrapper(indexService, settings, adminDns, cs, auditLog, ciol, evaluator, salt) ); indexModule.forceQueryCacheProvider((indexSettings, nodeCache) -> new QueryCache() { diff --git a/src/main/java/org/opensearch/security/configuration/SecurityFlsDlsIndexSearcherWrapper.java b/src/main/java/org/opensearch/security/configuration/SystemFlsDlsIndexSearcherWrapper.java similarity index 98% rename from src/main/java/org/opensearch/security/configuration/SecurityFlsDlsIndexSearcherWrapper.java rename to src/main/java/org/opensearch/security/configuration/SystemFlsDlsIndexSearcherWrapper.java index f66ff7a2c0..74d5ef0b83 100644 --- a/src/main/java/org/opensearch/security/configuration/SecurityFlsDlsIndexSearcherWrapper.java +++ b/src/main/java/org/opensearch/security/configuration/SystemFlsDlsIndexSearcherWrapper.java @@ -41,7 +41,7 @@ import org.opensearch.security.support.HeaderHelper; import org.opensearch.security.support.SecurityUtils; -public class SecurityFlsDlsIndexSearcherWrapper extends SecurityIndexSearcherWrapper { +public class SystemFlsDlsIndexSearcherWrapper extends SystemIndexSearcherWrapper { public final Logger log = LogManager.getLogger(this.getClass()); @@ -56,7 +56,7 @@ public class SecurityFlsDlsIndexSearcherWrapper extends SecurityIndexSearcherWra private final DlsQueryParser dlsQueryParser; private final Salt salt; - public SecurityFlsDlsIndexSearcherWrapper( + public SystemFlsDlsIndexSearcherWrapper( final IndexService indexService, final Settings settings, final AdminDNs adminDNs, diff --git a/src/main/java/org/opensearch/security/configuration/SecurityIndexSearcherWrapper.java b/src/main/java/org/opensearch/security/configuration/SystemIndexSearcherWrapper.java similarity index 98% rename from src/main/java/org/opensearch/security/configuration/SecurityIndexSearcherWrapper.java rename to src/main/java/org/opensearch/security/configuration/SystemIndexSearcherWrapper.java index bd88a62f4b..8e89b60712 100644 --- a/src/main/java/org/opensearch/security/configuration/SecurityIndexSearcherWrapper.java +++ b/src/main/java/org/opensearch/security/configuration/SystemIndexSearcherWrapper.java @@ -50,7 +50,7 @@ import org.greenrobot.eventbus.Subscribe; -public class SecurityIndexSearcherWrapper implements CheckedFunction { +public class SystemIndexSearcherWrapper implements CheckedFunction { protected final Logger log = LogManager.getLogger(this.getClass()); protected final ThreadContext threadContext; @@ -69,7 +69,7 @@ public class SecurityIndexSearcherWrapper implements CheckedFunction