Is there a way to see how access to a particular document set has been granted (i.e: where the permission has come from)?
context
We have several indices that employ document level security to restrict access, by role, to particular subsets of documents. This enables us to use an access control list to assign users to roles that grant read permissions over subsets of documents in our indices.
Although this has been working well for us previously, when it came time to configure this for a new index and role set, we find that users can see many more documents than they should be able to.
example where all is as-expected
GET /_security/role/banana_department_stockroom
{
"banana_department_stockroom" : {
"cluster" : [ ],
"indices" : [
{
"names" : [
"stockroom-reports-*",
"stockroom-reports"
],
"privileges" : [
"read",
"view_index_metadata"
],
"query" : """{"bool":{"filter":[{"term":{"org.unit_code":"banana_department"}}]}}""",
"allow_restricted_indices" : false
}
],
"applications" : [ /* kibana */ ],
"run_as" : [ ],
"metadata" : { },
"transient_metadata" : {
"enabled" : true
}
}
}
non-working example
GET /_security/role/banana_department_sales
{
"banana_department_sales" : {
"cluster" : [ ],
"indices" : [
{
"names" : [
"sales-reports-*",
"sales-reports"
],
"privileges" : [
"read",
"view_index_metadata"
],
"query" : """{"bool":{"filter":[{"term":{"org.unit_code":"banana_department"}}]}}""",
"allow_restricted_indices" : false
}
],
"applications" : [ ],
"run_as" : [ ],
"metadata" : { },
"transient_metadata" : {
"enabled" : true
}
}
}
In the working example, members of the banana department with the banana_department_stockroom
role can query the stockroom reports and only see their own data and don't see any data from the other departments; in searches it is as if they were the only department in the whole organisation. In Kibana's logs, we see expected audit events granting access for these queries.
However, in the case of the sales reports index, they can view all the other department's data. Kibana's logs show the same audit events.
I have checked all the other roles of affected users and cannot see any extraneous permissions that would affect this. If I perform a search using the same query
as above, I see the subset of documents I was expecting.
Any pointers would be greatly appreciated! I am going a little bananas myself trying to figure it out.
Many thanks!