Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5bd1280

Browse files
committed
add safety check
1 parentf7d22ea commit5bd1280

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎coderd/database/dbauthz/dbauthz.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,6 +2851,13 @@ func (q *querier) UpdateMemberRoles(ctx context.Context, arg database.UpdateMemb
28512851
// Convert the argument roles for validation.
28522852
scopedGranted:=make([]string,0,len(arg.GrantedRoles))
28532853
for_,grantedRole:=rangearg.GrantedRoles {
2854+
// This check is a developer safety check. Old code might try to invoke this code path with
2855+
// organization id suffixes. Catch this and return a nice error so it can be fixed.
2856+
_,foundOrg,_:=rbac.RoleSplit(grantedRole)
2857+
iffoundOrg!="" {
2858+
return database.OrganizationMember{},xerrors.Errorf("attempt to assign a role %q, remove the ':<organization_id> suffix",grantedRole)
2859+
}
2860+
28542861
scopedGranted=append(scopedGranted,rbac.RoleName(grantedRole,arg.OrgID.String()))
28552862
}
28562863

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp