Skip to content

Commit 5389ce4

Browse files
committed
check if newOwner != azpg.user before granting the role
1 parent 035c13a commit 5389ce4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/postgres/role.go

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ func (c *pg) CreateUserRole(role, password string) (string, error) {
3737
}
3838

3939
func (c *pg) GrantRole(role, grantee string) error {
40+
// Don't grant role to itself
41+
if grantee == role {
42+
return nil
43+
}
4044
_, err := c.db.Exec(fmt.Sprintf(GRANT_ROLE, role, grantee))
4145
if err != nil {
4246
return err

0 commit comments

Comments
 (0)