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

[BUG] do_not_fail_on_forbidden does not work with GET _all endpoint #5109

Open
buddemat opened this issue Feb 17, 2025 · 1 comment
Open
Labels
bug Something isn't working triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable.

Comments

@buddemat
Copy link

buddemat commented Feb 17, 2025

What is the bug?
The GET _all operation does not work as expected when do_not_fail_on_forbidden: true is set. A permission error is returned instead of a filtered list of results.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. set do_not_fail_on_forbidden: true
  2. create read-only user and role on some index pattern (here: test-read*) as follows
    PUT _plugins/_security/api/roles/ROLE_RO         
    {                                                
      "cluster_permissions": [                       
      ],                                             
      "index_permissions": [{                        
        "index_patterns": [                          
          "test-read*"                               
        ],                                           
        "dls": "",                                   
        "fls": [],                                   
        "masked_fields": [],                         
        "allowed_actions": [                         
          "read",                                    
          "indices:admin/get"                        
        ]                                            
      }],                                            
      "tenant_permissions": [{                       
        "tenant_patterns": [                         
        ],                                           
        "allowed_actions": [                         
        ]                                            
      }]                                             
    }                                                
    
    and
    PUT _plugins/_security/api/internalusers/USER_RO 
    {                                                
      "password": "whatever",                        
      "opendistro_security_roles": ["ROLE_RO"],      
      "backend_roles": ["ROLE_RO"],                  
      "attributes": {                                
      }                                              
    }                                                
    
  3. execute GET _all with said user
  4. get error
    {
      "error": {
        "root_cause": [
          {
            "type": "security_exception",
            "reason": "no permissions for [indices:admin/get] and User [name=USER_RO, backend_roles=[ROLE_RO], requestedTenant=]"
          }
       ],
        "type": "security_exception",
        "reason": "no permissions for [indices:admin/get] and User [name=USER_RO, backend_roles=[ROLE_RO], requestedTenant=]"
      },
      "status": 403
    } 
    

What is the expected behavior?
I expected to see a filtered result containing only the info for all indices matching the pattern test-read*, since the user/role has the indices:admin/getprivilege for them

What is your host/environment?

@buddemat buddemat added bug Something isn't working untriaged Require the attention of the repository maintainers and may need to be prioritized labels Feb 17, 2025
@cwperks cwperks added triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable. and removed untriaged Require the attention of the repository maintainers and may need to be prioritized labels Feb 17, 2025
@cwperks
Copy link
Member

cwperks commented Feb 17, 2025

[Triage] @buddemat Thank you for filing this issue. Looks like a bug that needs to be addressed. Thank you for providing the reproduction steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Issues labeled as 'Triaged' have been reviewed and are deemed actionable.
Projects
None yet
Development

No branches or pull requests

2 participants