Skip to content

[Bug]: Entity can define two roles with same name (last one configured wins) #1774

Closed
0 of 2 issues completed
Closed

Description

@yorek

What happened?

While DAB will still work fine, I was able to specify two roles with the same name for the same entity, for example:

 "permissions": [
        {
          "role": "test1",
          "actions": [
            {
              "action": "*",
              "policy": {
                "database": "@item.some_string eq 'Hello'"
              }
            }
          ]
        },
        {
          "role": "test1",
          "actions": [
            {
              "action": "*",
              "policy": {
                "database": "@item.some_number gt 10"
              }
            }
          ]
        }
      ]

I didn't get any error, but also it is not clear which role will be actually used (from looking at the generated SQL code, it looks like the last one wins).

During startup DAB should at least warn of the problem and return which role will be used or even just error out and stop execution. (I think giving a warning is better, and maybe we can error out only if some "strict" option is specified in the command line.

Version

Microsoft.DataApiBuilder 0.9.5-rc+73a02dcd3b85a73ac36a5675432a45b7a3cc4a7d

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

No response

Relevant log output

No errors returned

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. changed the title [-][Bug]: Roles with the same name can be specified in for the same entity[/-] [+][Bug]: Entity can define two roles with same name (last one configured wins)[/+] on May 14, 2024
  2. JerryNixon commented on May 15, 2026

    @JerryNixon
    Contributor

    Engineering validation bug. Needs a code fix (startup warning/error when duplicate role names detected). Not a documentation issue.

  3. JerryNixon commented on Jun 22, 2026

    @JerryNixon
    Contributor

    We will track this in the sub issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions