Skip to content

[BUG] java.lang.IllegalArgumentException: Must contain at least one column and at least one row (got []/[indices:monitor/recovery]) #5794

@Mmuzaf

Description

@Mmuzaf

What is the bug?

If the security plugin 2.19.3.0 is enabled, information about ongoing and completed shard recoveries cannot be obtained via the /_cat/recovery endpoint because all indices are closed (have been closed manually).

The request fails with:
java.lang.IllegalArgumentException: Must contain at least one column and at least one row (got []/[indices:monitor/recovery])

On 2.17 the same works fine, and setting plugins.security.privileges_evaluation.use_legacy_impl=true solves the issue.

How can one reproduce the bug?

  • Start 3-node cluster with a security plugin 2.19.3.0 enabled
  • Close all indices
  • curl /_cat/recovery

The resolution for such a request yelds an empty list:

        Set<String> resolvedIndicesSet = resolvedIndices.getAllIndicesResolved(
            context.getClusterStateSupplier(),
            context.getIndexNameExpressionResolver());

        // resolvedIndicesSet - empty list

The request fails with the stacktrace in logs:

Unexpected exception java.lang.IllegalArgumentException: Must contain at least one column and at least one row (got []/[indices:monitor/recovery])
java.lang.IllegalArgumentException: Must contain at least one column and at least one row (got []/[indices:monitor/recovery])
        at com.selectivem.collections.CheckTableImpl.create(CheckTableImpl.java:81) ~[special-collections-complete-1.4.0.jar:?]
        at com.selectivem.collections.CheckTable.create(CheckTable.java:75) ~[special-collections-complete-1.4.0.jar:?]
        at org.opensearch.security.privileges.ActionPrivileges.hasIndexPrivilege(ActionPrivileges.java:210) ~[opensearch-security-2.19.3.0.jar:2.19.3.0]
        at org.opensearch.security.privileges.PrivilegesEvaluatorImpl.evaluate(PrivilegesEvaluatorImpl.java:603) ~[opensearch-security-2.19.3.0.jar:2.19.3.0]
        at org.opensearch.security.filter.SecurityFilter.apply0(SecurityFilter.java:377) [opensearch-security-2.19.3.0.jar:2.19.3.0]
        at org.opensearch.security.filter.SecurityFilter.apply(SecurityFilter.java:166) [opensearch-security-2.19.3.0.jar:2.19.3.0]
        at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:218) [opensearch-2.19.3.jar:2.19.3]
        at org.opensearch.action.support.TransportAction.execute(TransportAction.java:190) [opensearch-2.19.3.jar:2.19.3]
        at org.opensearch.action.support.TransportAction.execute(TransportAction.java:109) [opensearch-2.19.3.jar:2.19.3]

What is the expected behavior?

The request completes fine.

What is your host/environment?

  • OS: Linux dev40 6.8.5-301.fc40.aarch64
  • OpenSearch 2.19.3
  • opensearch security plugin 2.19.3.0

Possible solution

The problem is probably in the following condition in the ActionPrivileges , when is actully not applied when isLocalAll == true (request containing "*").

The solution could be as simple as checking the resolved indices before passing them to the CheckTable:

    if (resolvedLocalIndices.isEmpty()) {
        return PrivilegesEvaluatorResponse.ok();
    }

Please, let me know what do you think and if I need prepare a fix for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagedIssues labeled as 'Triaged' have been reviewed and are deemed actionable.v3.4.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions