mozilla / persona

Persona is a secure, distributed, and easy to use identification system.
https://login.persona.org
Other
1.83k stars 265 forks source link

Auth with allowUnverified can fail due to attempted duplicate insert into emails table #4153

Open callahad opened 10 years ago

callahad commented 10 years ago

Related to Bugzilla Bug 1029014.

Marketplace is using Persona with allowUnverified and forceIssuer.

Guigs2 (a MoCo employee) attempted to sign into Marketplace on Fennec using her MoCo email address, only to see this screen after entering a new fallback password and hitting "next:"

503 error when staging user

The production logs show: unexpected database failure: Error: Duplicate entry '<redacted>@mozilla.com' for key 'address' -- at /opt/browserid/lib/db/mysql.js:733:13

That error is thrown at lib/db/mysql.js#L733, when db.createUnverifiedUser attempts to insert into the email table. The only call to db.createUnverifiedUser is in lib/wsapi/stage_user.js#L78, which either calls db.stageUser or db.createUnverifiedUser based on the value of allowUnverified.

In summary, we know:

Furthermore, after triggering the bug, the production database shows:

callahad commented 10 years ago

We apparently branched into stageUser when it wasn't appropriate, and improperly staged a new account, despite the user existing for several months.

callahad commented 10 years ago

As soon as Marketplace switches to Firefox Accounts (any day now), we can finally rip out the allowUnverified, forceIssuer, and forceAuthenticate hacks. On hold until then.