From acfe9c16ab9549d9931cfc63989408c6f66fbbbd Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 8 Sep 2022 14:42:28 -0400 Subject: [PATCH] Fix the inconsistent variable for DLS (#2056) (#2083) Signed-off-by: Ryan Liang Signed-off-by: Ryan Liang (cherry picked from commit 1efc512eb66884375bed5ea320d795922888f48b) Co-authored-by: Ryan Liang <109499885+RyanL1997@users.noreply.github.com> --- .../DlsFilterLevelActionHandler.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/opensearch/security/configuration/DlsFilterLevelActionHandler.java b/src/main/java/org/opensearch/security/configuration/DlsFilterLevelActionHandler.java index d2c02630e8..c0ecd6b9be 100644 --- a/src/main/java/org/opensearch/security/configuration/DlsFilterLevelActionHandler.java +++ b/src/main/java/org/opensearch/security/configuration/DlsFilterLevelActionHandler.java @@ -115,7 +115,7 @@ public static boolean handle(String action, ActionRequest request, ActionListene private final ThreadContext threadContext; private final IndexNameExpressionResolver resolver; private BoolQueryBuilder filterLevelQueryBuilder; - private DocumentAllowList documentWhitelist; + private DocumentAllowList documentAllowlist; DlsFilterLevelActionHandler(String action, ActionRequest request, ActionListener listener, EvaluatedDlsFlsConfig evaluatedDlsFlsConfig, Resolved resolved, Client nodeClient, ClusterService clusterService, IndicesService indicesService, @@ -178,8 +178,8 @@ private boolean handle() { } private boolean handle(SearchRequest searchRequest, StoredContext ctx) { - if (documentWhitelist != null) { - documentWhitelist.applyTo(threadContext); + if (documentAllowlist != null) { + documentAllowlist.applyTo(threadContext); } String localClusterAlias = LOCAL_CLUSTER_ALIAS_GETTER.apply(searchRequest); @@ -225,8 +225,8 @@ public void onFailure(Exception e) { } private boolean handle(GetRequest getRequest, StoredContext ctx) { - if (documentWhitelist != null) { - documentWhitelist.applyTo(threadContext); + if (documentAllowlist != null) { + documentAllowlist.applyTo(threadContext); } SearchRequest searchRequest = new SearchRequest(getRequest.indices()); @@ -270,8 +270,8 @@ public void onFailure(Exception e) { } private boolean handle(MultiGetRequest multiGetRequest, StoredContext ctx) { - if (documentWhitelist != null) { - documentWhitelist.applyTo(threadContext); + if (documentAllowlist != null) { + documentAllowlist.applyTo(threadContext); } Map> idsGroupedByIndex = multiGetRequest.getItems().stream() @@ -395,7 +395,7 @@ private boolean createQueryExtension(String localClusterAlias) throws IOExceptio Map> filterLevelQueries = evaluatedDlsFlsConfig.getDlsQueriesByIndex(); BoolQueryBuilder dlsQueryBuilder = QueryBuilders.boolQuery().minimumShouldMatch(1); - DocumentAllowList documentWhitelist = new DocumentAllowList(); + DocumentAllowList documentAllowlist = new DocumentAllowList(); int queryCount = 0; @@ -450,7 +450,7 @@ private boolean createQueryExtension(String localClusterAlias) throws IOExceptio for (QueryBuilder queryBuilder : queryBuilders) { TermsQueryBuilder termsQueryBuilder = (TermsQueryBuilder) queryBuilder; - documentWhitelist.add(termsQueryBuilder.termsLookup().index(), termsQueryBuilder.termsLookup().id()); + documentAllowlist.add(termsQueryBuilder.termsLookup().index(), termsQueryBuilder.termsLookup().id()); } } @@ -461,7 +461,7 @@ private boolean createQueryExtension(String localClusterAlias) throws IOExceptio return false; } else { this.filterLevelQueryBuilder = dlsQueryBuilder; - this.documentWhitelist = documentWhitelist; + this.documentAllowlist = documentAllowlist; return true; } }