diff --git a/internal/jimm/cloudcredential.go b/internal/jimm/cloudcredential.go index 037ebcd87..5691a2c06 100644 --- a/internal/jimm/cloudcredential.go +++ b/internal/jimm/cloudcredential.go @@ -342,6 +342,9 @@ func (j *JIMM) GetCloudCredentialAttributes(ctx context.Context, user *openfga.U err = errors.E(op, err) return } + if len(attrs) == 0 { + return map[string]string{}, nil, nil + } if hidden { return diff --git a/internal/jimm/cloudcredential_test.go b/internal/jimm/cloudcredential_test.go index f711a7ed3..66a9a8c67 100644 --- a/internal/jimm/cloudcredential_test.go +++ b/internal/jimm/cloudcredential_test.go @@ -1575,7 +1575,7 @@ var getCloudCredentialAttributesTests = []struct { username: "bob@canonical.com", jimmAdmin: true, cred: "cred-2", - expectAttributes: nil, + expectAttributes: map[string]string{}, expectRedacted: nil, }, { name: "OwnerWithHidden",