RBAC: Reject plugin registrations without a name (#81719)

* RBAC: Reject plugin registrations without a name

* Lint'
This commit is contained in:
Gabriel MABILLE
2024-02-02 11:12:00 +01:00
committed by GitHub
parent 65e9990a87
commit 4a1e8f3d98
3 changed files with 28 additions and 6 deletions
@@ -34,6 +34,9 @@ func ValidatePluginRole(pluginID string, role ac.RoleDTO) error {
if pluginID == "" {
return ac.ErrPluginIDRequired
}
if role.DisplayName == "" {
return &ac.ErrorRoleNameMissing{}
}
if !strings.HasPrefix(role.Name, ac.PluginRolePrefix+pluginID+":") {
return &ac.ErrorRolePrefixMissing{Role: role.Name, Prefixes: []string{ac.PluginRolePrefix + pluginID + ":"}}
}