Skip to content

Commit

Permalink
add nullifier check in light
Browse files Browse the repository at this point in the history
  • Loading branch information
chabanyknikita committed Oct 23, 2024
1 parent 0372aaa commit 886213d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/service/handlers/verification_callback_light.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,15 @@ func VerificationSignatureCallback(w http.ResponseWriter, r *http.Request) {
return
}

if byAnonymousID != nil && byAnonymousID.UserIDHash != verifiedUser.UserIDHash {
byNullifier, dbErr := VerifyUsersQ(r).FilterByNullifier(nullifierHex).Get()
if dbErr != nil {
Log(r).Error("Failed to get user by nullifier")
ape.RenderErr(w, problems.BadRequest(dbErr)...)
return
}

if byNullifier != nil && byNullifier.UserIDHash != verifiedUser.UserIDHash &&
byAnonymousID != nil && byAnonymousID.UserIDHash != verifiedUser.UserIDHash {
Log(r).WithError(err).Errorf("User with anonymous_id [%s] but a different userIDHash already exists", anonymousIDHex)
verifiedUser.Status = "failed_verification"
} else {
Expand Down

0 comments on commit 886213d

Please sign in to comment.