Skip to content

[BUG] Role with Document-level security (DLS) masks more generic permissions #3773

@rufdoSICKAG

Description

@rufdoSICKAG

What is the bug?
When a user has 2 roles, one that permits him to read all documents of an index and one that restricts the permissions to certain documents via DLS, he only has access to the ones meeting the DLS criteria.

I noticed this because, even though my user all_access role, he was not able to see a lot of documents.
The reason was, that via a backend_role, my user had also a role that limited the access via DLS.

Only after creating another role with the DLS { "match_all": {}}, and adding this role to my user, was I able to see the documents again.

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

  1. create role
myrole:
  index_permissions:
  - index_patterns:
    - myindex-*
    dls: "{\"terms\": { \"myfield.keyword\": [\"nonexistincvalue\"]}}"
    allowed_actions:
    - search
  1. Give this role to a user that already has all_access role
  2. With this user search for any documents GET myindex-*/_search
  3. Even though the index contains some documents and the user has the all_access role the search has no results

What is the expected behavior?
I expected the permissions to be additiv and not loose permissions when getting an additional role.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions