Skip to content

Commit

Permalink
fix: don't allow creating an auth with instance resources (#23674)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyssmith2nd authored and jsternberg committed Sep 13, 2022
1 parent 11019d2 commit b87deb4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions authorization/middleware_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func (s *AuthedAuthorizationService) CreateAuthorization(ctx context.Context, a
if err := authorizer.VerifyPermissions(ctx, a.Permissions); err != nil {
return err
}
for _, v := range a.Permissions {
if v.Resource.Type == influxdb.InstanceResourceType {
return fmt.Errorf("authorizations cannot be created with the instance type, it is only used during setup")
}
}

return s.s.CreateAuthorization(ctx, a)
}
Expand Down

0 comments on commit b87deb4

Please sign in to comment.