forked from Silverfish/proton-bridge
fix(GODT-3123): Trigger bad event on empty EventID on existing accounts
See `checkIrrecoverableEventID` for more details.
This commit is contained in:
@ -105,6 +105,7 @@ func New(
|
||||
eventSubscription events.Subscription,
|
||||
syncService syncservice.Regulator,
|
||||
syncConfigDir string,
|
||||
isNew bool,
|
||||
) (*User, error) {
|
||||
user, err := newImpl(
|
||||
ctx,
|
||||
@ -122,6 +123,7 @@ func New(
|
||||
eventSubscription,
|
||||
syncService,
|
||||
syncConfigDir,
|
||||
isNew,
|
||||
)
|
||||
if err != nil {
|
||||
// Cleanup any pending resources on error
|
||||
@ -152,6 +154,7 @@ func newImpl(
|
||||
eventSubscription events.Subscription,
|
||||
syncService syncservice.Regulator,
|
||||
syncConfigDir string,
|
||||
isNew bool,
|
||||
) (*User, error) {
|
||||
logrus.WithField("userID", apiUser.ID).Info("Creating new user")
|
||||
|
||||
@ -295,6 +298,14 @@ func newImpl(
|
||||
return nil
|
||||
})
|
||||
|
||||
// If it's not a fresh user check the eventID and evaluate whether it is valid. If it's a new user, we don't
|
||||
// need to perform this check.
|
||||
if !isNew {
|
||||
if err := checkIrrecoverableEventID(ctx, encVault.EventID(), apiUser.ID, syncConfigDir, user); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Start Event Service
|
||||
lastEventID, err := user.eventService.Start(ctx, user.serviceGroup)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user