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

GetDataStreamAction with verbose: true fails with an error that it tries to access .security when executed as superuser #117993

Open
gmarouli opened this issue Dec 4, 2024 · 1 comment · May be fixed by #118011
Assignees
Labels
>bug :Data Management/Data streams Data streams and their lifecycles Team:Data Management Meta label for data/management team v8.16.0 v9.0.0

Comments

@gmarouli
Copy link
Contributor

gmarouli commented Dec 4, 2024

Elasticsearch Version

8.16.0+

Problem Description

With #112973 we introduce the possibility to request a more verbose version of GET _data_stream. However, in certain cases it throws an authorisation error.

The problem appears when:

  • A superuser performs the GET _data_stream request
  • Querying all including hidden indices
  • The cluster has system indices, for example, .security-7

The problem appears to be that using the wide access of the superuser, the resource resolution is very wide as well, including also the .security-7 index which the _xpack internal user does not have access.

A potential fix could be to pass in the stats request the requested data stream names getDataStreams(state, indexNameExpressionResolver, request), this does appear to work.

Steps to Reproduce

  1. Run elasticsearch with security enabled.

  2. Ensure you have the .security-7 index available

GET /_cat/indices/.security*

green open .security-7 BnBnnwitT0qHSde3kevfmA 1 0 1 0 4.9kb 4.9kb 4.9kb
  1. If they do not exist, add a user to initialise them
POST /_security/user/limited_user
{
  "roles": [],
  "password": "something"
}
  1. After you have ensured the .security* indices exist, execute the "troubled" request
GET http://localhost:9200/_data_stream/*?expand_wildcards=all&verbose=true

{
  "error": {
    "root_cause": [
      {
        "type": "security_exception",
        "reason": "action [indices:monitor/data_stream/stats] is unauthorized for user [_xpack] with effective roles [_xpack] on restricted indices [.security-7], this action is granted by the index privileges [monitor,manage,all]"
      }
    ],
    "type": "security_exception",
    "reason": "action [indices:monitor/data_stream/stats] is unauthorized for user [_xpack] with effective roles [_xpack] on restricted indices [.security-7], this action is granted by the index privileges [monitor,manage,all]"
  },
  "status": 403
}

@gmarouli gmarouli added :Data Management/Data streams Data streams and their lifecycles >bug needs:triage Requires assignment of a team area label v8.16.0 v9.0.0 labels Dec 4, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Dec 4, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Dec 4, 2024
@gmarouli gmarouli changed the title GetDataStreamAction with verbose: true fails with an error that it tries to access .security GetDataStreamAction with verbose: true fails with an error that it tries to access .security when executed as superuser Dec 4, 2024
@gmarouli gmarouli self-assigned this Dec 4, 2024
gmarouli added a commit to gmarouli/elasticsearch that referenced this issue Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Data streams Data streams and their lifecycles Team:Data Management Meta label for data/management team v8.16.0 v9.0.0
Projects
None yet
2 participants