Open
Description
Elasticsearch Version
8.16 and up
Installed Plugins
No response
Java Version
bundled
OS Version
irrelevant
Problem Description
#110633 introduced the global cluster manage role privilege. This privilege allows limiting the resources and privileges an Elasticsearch user can grant permissions to.
Currently, it's possible to include invalid named privileges in its definition, e.g.,:
POST /_security/role/bad-role
{
"global": {
"role": {
"manage": {
"indices": [
{
"names": ["allowed-index-prefix-*"],
"privileges":["foobar"] <- not a valid named privilege
}
]
}
}
}
}
This results in a broken role -- a user assigned with this role will receive failures at runtime when attempting to authenticate.
We can instead prevent this by adding a validation step during role creation, here-abouts.
Steps to Reproduce
Create a role with the global manage role permission that includes an unknown named privilege:
POST /_security/role/bad-role
{
"global": {
"role": {
"manage": {
"indices": [
{
"names": ["allowed-index-prefix-*"],
"privileges":["foobar"] <- not a valid named privilege
}
]
}
}
}
}
Create a user with that role:
POST /_security/user/bad-user
{
"password": "so-secure",
"roles": ["bad-role"]
}
Call an Elasticsearch API with that user:
GET /_security/_authenticate
Logs (if relevant)
No response