Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accounts: switch to AWS Cognito or SuperTokens? #107

Closed
5 tasks
lefnire opened this issue Nov 9, 2020 · 5 comments
Closed
5 tasks

Accounts: switch to AWS Cognito or SuperTokens? #107

lefnire opened this issue Nov 9, 2020 · 5 comments
Labels
🔒Account/Security User account & security stuff help wanted Extra attention is needed
Projects

Comments

@lefnire
Copy link
Collaborator

lefnire commented Nov 9, 2020

Me handling of email verification, JWT refresh token, integrating Oauth providers (Google, Facebook, etc) is a really stupid idea. I don't want to be in charge of the security of that. Will close a few tickets on those points, referencing this as the way forward. I'll switch to AWS Cognito (since I'm on AWS); but there are other providers like Auth0. Tutorial


Update: consider open source Super Tokens instead. Benefit is it can use own database. 3rd-party dep yes, but managed within Docker cluster and full control. Likely less overhead/coupling, easier testing than Cognito

@lefnire lefnire added help wanted Extra attention is needed 🔒Account/Security User account & security stuff labels Nov 9, 2020
@lefnire lefnire added this to Beta in Main via automation Nov 9, 2020
@lefnire lefnire moved this from Beta to In Progress in Main Nov 22, 2020
@mark-todd
Copy link

mark-todd commented Nov 26, 2020

Hi there - I've just noticed this issue chain. We've actually been working on an email verification system over the past couple of days, to integrate into fastapi users (based on the discussion in issue 106 in fastapi_users), and will be making a pull request shortly - not sure if this might affect your plans, so thought you may want to know (followed this from issue 102) @lefnire

@lefnire
Copy link
Collaborator Author

lefnire commented Nov 26, 2020

@mark-todd thanks for bumping! I did see activity on the email verification, that's fantastic. And Frankie re-opened the refresh token ticket fastapi-users/fastapi-users#350, which was actually a larger issue for this ticket - that's great!

I'm still on the fence for all scenarios. Gnothi is insanely security-conscious, borderline bank-website security needs, because if users' journal entries got hacked that's very damaging. For this reason I considered Cognito for all the stuff I may not be considering (they're likely rotating secret keys for JWT signing; I only recently found out about refresh token stuff, and what else am I not considering). Built-in email verification, forgot-password, and 2FA (I'll need 2FA). Stuff like this. On the flip side, Cognito (and many other services) has been down in us-east-1 for the past what.. 24hrs? So I'm damn glad I didn't already make the switch. But yeah, I think this ticket could use some conversation.

  1. fastapi-users. Pros: built into site; no single point of failure (as long as the server's distributed, per Cognito outage); easier testing & management. Cons: missing features (email verification, 2FA, refresh token); what vulnerabilities might be present that a dedicated product would be handling?
  2. fastapi-jwt-auth. Pros: bit more security-flexible than fastapi-users (eg, refresh-token). Cons: more leg-work on the app side; fastapi-users sets up routes, tables, forgot-password, etc.
  3. Cognito. Pros: presumably much more security-heavy (by default) than either the above (assuming rotation of signing keys, etc); feature-complete (2FA, emails, etc). Cons: single point of failure, harder to manage (accounts over there, user rows over here), harder to test.

@lefnire lefnire changed the title Accounts: switch to AWS Cognito Accounts: switch to AWS Cognito? Nov 26, 2020
@eddsalkield
Copy link

Mark and I have submitted a PR to FastAPI-Users which implements a flow for user activation. It would be interesting to hear your thoughts in the conversation thread over there.

@lefnire
Copy link
Collaborator Author

lefnire commented Dec 1, 2020

That's fantastic, great job @eddsalkield! I'll subscribe to that PR

@lefnire lefnire changed the title Accounts: switch to AWS Cognito? Accounts: switch to AWS Cognito or SuperTokens? Dec 8, 2020
@lefnire
Copy link
Collaborator Author

lefnire commented May 23, 2021

7e34650 (and some prior commits) switch to Cognito. AWS Cognito has some bells/whistles (like Auth0, but I'm already using AWS for everything anyway) like forgot/reset password; logout other devices; MFA; prevent password-stuffing; etc. Ie, it's more secure and robust - vital given the subject matter. When I push the new version, users will be required to reset their password. You can use the same password as before, it's just that it's a new back-end and (a) Cognito doesn't allow importing passwords; (b) Gnothi DB's passwords are hashed anyway, so couldn't be migrated.

@lefnire lefnire closed this as completed May 23, 2021
Main automation moved this from In Progress to Done May 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔒Account/Security User account & security stuff help wanted Extra attention is needed
Projects
Archived in project
Main
  
Done
Development

No branches or pull requests

3 participants