From 3bebce1b7da717904753c55f9bc7a0855ab9da14 Mon Sep 17 00:00:00 2001 From: Rutuja Surve Date: Tue, 9 Aug 2022 22:13:55 +0530 Subject: [PATCH] Revert backport of #1885 Signed-off-by: Rutuja Surve --- .../resolver/IndexResolverReplacer.java | 4 +- .../security/PrivilegesEvaluationTest.java | 40 ------------------- src/test/resources/internal_users.yml | 10 ----- 3 files changed, 2 insertions(+), 52 deletions(-) delete mode 100644 src/test/java/com/amazon/opendistroforelasticsearch/security/PrivilegesEvaluationTest.java diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/security/resolver/IndexResolverReplacer.java b/src/main/java/com/amazon/opendistroforelasticsearch/security/resolver/IndexResolverReplacer.java index 137b318eaf..4551fb4f32 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/security/resolver/IndexResolverReplacer.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/security/resolver/IndexResolverReplacer.java @@ -740,7 +740,7 @@ private boolean getOrReplaceAllIndices(final Object request, final IndicesProvid private IndicesOptions indicesOptionsFrom(Object localRequest) { if(!respectRequestIndicesOptions) { - return IndicesOptions.fromOptions(false, true, true, false, true); + return IndicesOptions.fromOptions(false, true, true, false); } if (IndicesRequest.class.isInstance(localRequest)) { @@ -750,7 +750,7 @@ else if (RestoreSnapshotRequest.class.isInstance(localRequest)) { return ((RestoreSnapshotRequest) localRequest).indicesOptions(); } else { - return IndicesOptions.fromOptions(false, true, true, false, true); + return IndicesOptions.fromOptions(false, true, true, false); } } diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/security/PrivilegesEvaluationTest.java b/src/test/java/com/amazon/opendistroforelasticsearch/security/PrivilegesEvaluationTest.java deleted file mode 100644 index 65d9e8a62c..0000000000 --- a/src/test/java/com/amazon/opendistroforelasticsearch/security/PrivilegesEvaluationTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.amazon.opendistroforelasticsearch.security; - -import org.junit.Assert; -import org.junit.Test; -import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.support.WriteRequest.RefreshPolicy; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.xcontent.XContentType; -import com.amazon.opendistroforelasticsearch.security.test.SingleClusterTest; -import com.amazon.opendistroforelasticsearch.security.test.helper.rest.RestHelper; - -import com.google.common.collect.ImmutableMap; - -public class PrivilegesEvaluationTest extends SingleClusterTest { - @Test - public void resolveTestHidden() throws Exception { - - setup(); - - try (Client client = getInternalTransportClient()) { - - client.index(new IndexRequest("hidden_test_not_hidden").setRefreshPolicy(RefreshPolicy.IMMEDIATE).source(XContentType.JSON, "index", - "hidden_test_not_hidden", "b", "y", "date", "1985/01/01")).actionGet(); - - client.admin().indices().create(new CreateIndexRequest(".hidden_test_actually_hidden").settings(ImmutableMap.of("index.hidden", true))) - .actionGet(); - client.index(new IndexRequest(".hidden_test_actually_hidden").id("test").source("a", "b").setRefreshPolicy(RefreshPolicy.IMMEDIATE)) - .actionGet(); - } - RestHelper rh = nonSslRestHelper(); - RestHelper.HttpResponse httpResponse = rh.executeGetRequest("/*hidden_test*/_search?expand_wildcards=all&pretty=true", - encodeBasicHeader("hidden_test", "nagilum")); - Assert.assertEquals(httpResponse.getBody(), 403, httpResponse.getStatusCode()); - - httpResponse = rh.executeGetRequest("/hidden_test_not_hidden?pretty=true", - encodeBasicHeader("hidden_test", "nagilum")); - Assert.assertEquals(httpResponse.getBody(), 200, httpResponse.getStatusCode()); - } -} diff --git a/src/test/resources/internal_users.yml b/src/test/resources/internal_users.yml index 7ab1306899..5f9f944ccb 100644 --- a/src/test/resources/internal_users.yml +++ b/src/test/resources/internal_users.yml @@ -334,14 +334,4 @@ foo_all: bulk_test_user: hash: $2a$12$n5nubfWATfQjSYHiWtUyeOxMIxFInUHOAx8VMmGmxFNPGpaBmeB.m #password is: nagilum -hidden_test: - hash: $2a$12$n5nubfWATfQjSYHiWtUyeOxMIxFInUHOAx8VMmGmxFNPGpaBmeB.m - opendistro_security_roles: - - hidden_test -sem-user: - hash: $2a$12$n5nubfWATfQjSYHiWtUyeOxMIxFInUHOAx8VMmGmxFNPGpaBmeB.m - #password is: nagilum -sem-user2: - hash: $2a$12$n5nubfWATfQjSYHiWtUyeOxMIxFInUHOAx8VMmGmxFNPGpaBmeB.m - #password is: nagilum