Skip to content

Commit e0e8f51

Browse files
committed
fix: panic in CreateOrGetUser when user has no emails
response.Emails[0].Value in the slog.Warn call would panic if the user retrieved from AWS SSO had no emails (e.g. data inconsistency). Replace with (*User)(response).GetPrimaryEmailAddress() which already exists on the User type and safely returns an empty string when no primary email is found.
1 parent 595d357 commit e0e8f51

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/aws/scim.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func (s *SCIMService) CreateOrGetUser(ctx context.Context, cur *CreateUserReques
340340
"externalId", response.ExternalID,
341341
"active", response.Active,
342342
"displayName", response.DisplayName,
343-
"email", response.Emails[0].Value,
343+
"email", (*User)(response).GetPrimaryEmailAddress(),
344344
)
345345

346346
pur := &PutUserRequest{

0 commit comments

Comments
 (0)