UserSync: Avoid UpdateLastSeenAt with invalid user ids (#72776)

* avoid user zero

* more errors

* more tests

* split
This commit is contained in:
Ryan McKinley
2023-08-03 08:26:02 +02:00
committed by GitHub
parent 1b93f3c0ab
commit 7431c0ddb1
4 changed files with 29 additions and 3 deletions
@@ -136,9 +136,13 @@ func (s *UserSync) SyncLastSeenHook(ctx context.Context, identity *authn.Identit
namespace, id := identity.NamespacedID()
// do not sync invalid users
if id <= 0 {
return nil // skip sync
}
if namespace != authn.NamespaceUser && namespace != authn.NamespaceServiceAccount {
// skip sync
return nil
return nil // skip sync
}
go func(userID int64) {