Skip to content

Commit d33f88d

Browse files
[management] only allow user devices to be expired (#4445)
1 parent 786ca6f commit d33f88d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

management/server/account.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,9 @@ func (am *DefaultAccountManager) onPeersInvalidated(ctx context.Context, account
17141714
log.WithContext(ctx).Errorf("failed to get invalidated peer %s for account %s: %v", peerID, accountID, err)
17151715
continue
17161716
}
1717-
peers = append(peers, peer)
1717+
if peer.UserID != "" {
1718+
peers = append(peers, peer)
1719+
}
17181720
}
17191721
if len(peers) > 0 {
17201722
err := am.expireAndUpdatePeers(ctx, accountID, peers)

management/server/user.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,11 @@ func (am *DefaultAccountManager) expireAndUpdatePeers(ctx context.Context, accou
942942
// nolint:staticcheck
943943
ctx = context.WithValue(ctx, nbContext.PeerIDKey, peer.Key)
944944

945+
if peer.UserID == "" {
946+
// we do not want to expire peers that are added via setup key
947+
continue
948+
}
949+
945950
if peer.Status.LoginExpired {
946951
continue
947952
}

0 commit comments

Comments
 (0)