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

πŸ§‘β€πŸ”¬ Prototype: MFA for owners of top 100 downloaded gems (CLI) #9

Closed
wants to merge 3 commits into from

Conversation

jenshenny
Copy link

@jenshenny jenshenny commented Jan 12, 2022

Overview

Builds off of the UI flow #8

This prototype relates to the stage of encouraging users, and requiring users to set up mfa in the CLI.

User in the encouragement state

The regular response is sent back with signin, push/yank gems, and add/remove owners actions along with a message (or warning) to encourage users to set up MFA.

Gem signin

This requires changes to the rubygems' gem signin command as the response from the rubygems.org API when creating an API key is the API key itself. Before creating an API key, an request is sent to api/v1/profile determine if MFA is enabled on the account, and if not, a message gets shown (see Shopify/rubygems#1). This applies to all users and not the targetted ones.

We could display it for targeted users however. This would require another field to be added to the profile for user messages or warnings (rubygems.org, rubygems). It might be worth adding this field to communicate info in future initiatives (eg. gem signing).

Screen Shot 2022-01-11 at 8 51 51 PM

Gem push/yank gems, and add/remove owners

A message is appended to the end of the response body of these commands. A warning cannot be appended before since these commands can check the beginning of the response body to determine certain states (eg. mfa unauthorized). This applies to users that have been targetted via the mfa_required? method (ie. most downloaded gem owners) on the user.

Screen Shot 2022-01-11 at 9 01 44 PM

User in the required state

When a user tries to signin, push/yank gems, and add/remove owners, a message renders to make the user setup MFA if the user doesn't have MFA enabled with the forbidden response. This is only limited to the accounts that is targeted by mfa_required?.

Gem signin

Could make it so the signin exits early if we use the targeted user warning approach mentioned in gem signin in the encouraging phase. The warning field would store a list of warnings as well as if they should early exit (eg. [{msg:"WARNING...", exit: true}, ...]).
Screen Shot 2022-01-13 at 9 20 13 AM

Gem push

Screen Shot 2022-01-11 at 9 16 41 PM


def response_with_mfa_warning(response)
return response unless should_setup_mfa?
message = "\n\n[WARNING] For protection of your account and your gems, you are encouraged to set up multi-factor authentication at https://rubygems.org/multifactor_auth/new. Your account will be required have MFA enabled in the future."
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your account will be required have MFA enabled in the future

We can specify the date with require_mfa_at

add_column :users, :require_mfa_at, :datetime

@jenshenny jenshenny changed the title πŸ§‘β€πŸ”¬ Prototype: Encourage MFA for owners of top 100 downloaded gems (CLI) πŸ§‘β€πŸ”¬ Prototype: MFA for owners of top 100 downloaded gems (CLI) Jan 13, 2022
@aellispierce
Copy link

I'm going to close this out since the work building off this prototype has been merged into the main repo πŸŽ‰ 🧹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants