Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default behavior for _cat/indices to return indices visible to requesting user #5196

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Mar 21, 2025

Description

Opening this PR up to show what's required for changing the default behavior of _cat/indices so that it always returns a list of the indices that the requesting user has access to.

This makes it possible to have roles where the index pattern is scoped down from *. In the current behavior, this role would always get a forbidden error when calling _cat/indices unless do_not_fail_on_forbidden is set to true.

test:
  cluster_permissions: []
  index_permissions:
    - index_patterns:
        - "test-*"
      allowed_actions:
        - indices_all
  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)

Enhancement

Issues Resolved

Resolves #5195

Check List

  • New functionality includes testing
  • New functionality has been documented
  • New Roles/Permissions have a corresponding security dashboards plugin PR
  • API changes companion pull request created
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@@ -538,7 +536,8 @@ public PrivilegesEvaluatorResponse evaluate(PrivilegesEvaluationContext context)
}
}

boolean dnfofPossible = dnfofEnabled && DNFOF_MATCHER.test(action0);
boolean dnfofPossible = (dnfofEnabled && DNFOF_MATCHER.test(action0))
|| Set.of("indices:monitor/settings/get", "indices:monitor/stats").contains(action0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be extracted to a different constant

cwperks added 2 commits March 21, 2025 16:12
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Copy link

codecov bot commented Mar 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.73%. Comparing base (dae9f6c) to head (dcaa783).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5196      +/-   ##
==========================================
+ Coverage   71.67%   71.73%   +0.05%     
==========================================
  Files         337      337              
  Lines       22789    22791       +2     
  Branches     3606     3606              
==========================================
+ Hits        16334    16348      +14     
+ Misses       4651     4639      -12     
  Partials     1804     1804              
Files with missing lines Coverage Δ
...earch/security/privileges/PrivilegesEvaluator.java 74.11% <100.00%> (+0.15%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reconsider default behavior for DNFOF in 3.0.0
1 participant