Skip to content

Commit

Permalink
Only run DlsFlsValveImpl.invoke on indices requests
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Nov 25, 2024
1 parent a8447cc commit eecba3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
import org.opensearch.security.support.ConfigConstants;
import org.opensearch.threadpool.ThreadPool;

import static org.opensearch.security.privileges.PrivilegesEvaluator.isIndexPerm;

public class DlsFlsValveImpl implements DlsFlsRequestValve {

private static final String MAP_EXECUTION_HINT = "map";
Expand Down Expand Up @@ -135,6 +137,10 @@ public DlsFlsValveImpl(
*/
@Override
public boolean invoke(PrivilegesEvaluationContext context, final ActionListener<?> listener) {
if (!isIndexPerm(context.getAction())) {
return true;
}

DlsFlsProcessedConfig config = this.dlsFlsProcessedConfig.get();
ActionRequest request = context.getRequest();
IndexResolverReplacer.Resolved resolved = context.getResolvedRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,10 @@ public static boolean isClusterPerm(String action0) {
|| (action0.equals(RenderSearchTemplateAction.NAME)));
}

public static boolean isIndexPerm(String action0) {
return (action0.startsWith("indices:") && !isClusterPerm(action0));
}

@SuppressWarnings("unchecked")
private boolean checkFilteredAliases(Resolved requestedResolved, String action, boolean isDebugEnabled) {
final String faMode = dcm.getFilteredAliasMode();// getConfigSettings().dynamic.filtered_alias_mode;
Expand Down

0 comments on commit eecba3a

Please sign in to comment.