Azure / azure-service-operator

Azure Service Operator allows you to create Azure resources using kubectl
https://azure.github.io/azure-service-operator/
MIT License
741 stars 195 forks source link

DBforPostgreSQL User can only be assigned lowercase roles #4334

Open Paul-B98 opened 1 week ago

Paul-B98 commented 1 week ago

Describe the current behavior It seems that the current behaviour only allows the assignment of roles that are written in lowercase to a user. This results in an error that the corresponding role cannot be found when deviating from lowercase lettering. A testcase to reproduce this behaviour is to add uppercase letters or hyphens to the name of the admin role. When creating a new user that role should be assignable but is not.

Describe the improvement It would be helpful if there is a way to also allow the assignment of roles that contains letter in uppercase or hyphens.

theunrepentantgeek commented 1 week ago

Do you have the exact error message available to share? This would help us isolate the underlying code.

matthchr commented 1 week ago

Can you also share an example user input (a User) you've given that produces an error? Don't forget to redact the password.

My quick scan of the code suggests that other than performing some sql-injection-escaping safety checks, the value you pass for roles is passed as is directly to the server, so if you have defined the roles as uppercase you should be able to refer to them as uppercase.

See https://stackoverflow.com/questions/27638358/role-names-are-case-sensitive-in-postgres which talks about this some.

You'll need to match the case of the role in the server in the User specification.