Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 Add User.mfa_required? by kevinlinxc · Pull Request #3135 · rubygems/rubygems.org · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content

Conversation

kevinlinxc
Copy link
Contributor
@kevinlinxc kevinlinxc commented Jul 6, 2022

Adds a function to check if a User requires mfa due to the number of downloads on one of their gems in preparation for future MFA requirement work.

Edit, more info:

The mfa_required function will check if a user needs to enable mfa because one of the packages they own passed the MFA-required downloads threshold. Eventually, this will block them from taking some actions that require authentication.

Doesn't use the function/block the user's access to anything.

Copy link
Member
@jenshenny jenshenny left a comment

Choose a reason for hiding this comment

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

LGTM! Since mfa_required? is a private method, we should add a public interface for us to use (ie. required versions of mfa_recommended_not_yet_enabled?, mfa_recommended_weak_level_enabled?) either in this PR or a fast followup.

@kevinlinxc
Copy link
Contributor Author

Added mfa_required_not_yet_enabled? and mfa_required_weak_level_enabled? and tests. The weak level checks will be deleted after UI Only is removed 8000 , right?

@jenshenny
Copy link
Member

The weak level checks will be deleted after UI Only is removed, right?

That is correct 👍 After the migration is done we would probably need to do some cleanup

@kevinlinxc kevinlinxc force-pushed the mfa-required-surpassed-threshold branch from e3af4a6 to 037ccbf Compare July 12, 2022 20:05
@simi
Copy link
Contributor
simi commented Jul 13, 2022

🤔 It is hard to do review when those methods are not used yet. Are they going to be part of some next PR as well?

Copy link
Contributor
@bettymakes bettymakes left a comment

Choose a reason for hiding this comment

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

Left a few notes, food for thought 😊. Overall, it looks like it sets up the groundwork well for the next set of work.

That said, it'd be great if the PR description was more detailed and provided insight into what these methods are in preparation for (especially since the methods aren't actually being used and are simply being defined in this PR).

@jenshenny
Copy link
Member
8000 jenshenny commented Jul 13, 2022

🤔 It is hard to do review when those methods are not used yet. Are they going to be part of some next PR as well?

@simi good point, sorry for not being transparent. I believe the plan is to do something similar with what we did with the warnings.

  1. Create a PR with the mfa_required methods
  2. Create a PR to use the mfa_required methods for the UI (this time redirecting to MFA pages on authenticated pages like https://github.com/Shopify/rubygems.org/pull/10/files) behind a feature cookie
  3. Create a PR to use mfa_required methods for the CLI and merge on release (blocking gem push, yank, etc like Shopify@6958f7c)
  4. Create a PR to remove the required cookie on release.

Maybe it makes more sense to have 1+2 in this PR as they can be merged before launch. The original rationale to have 1 separate is that we can do 2 and 3 in parallel.

(I'll create an issue to track this too)

@kevinlinxc
Copy link
Contributor Author

Implemented all of @bettymakes feedback and also changed:

rubygem.mfa_required_from_downloads scope to mfa_required
rubygem.mfa_required? method to metadata_mfa_required?
version.rubygems_mfa_required? method to rubygems_metadata_mfa_required? (Maybe too long).

I think adding the distinction between policy and metadata mfa_required here makes sense, as Rubygem.mfa_required? and User.mfa_required? are now related, as you would expect, compared to before this refactor.

@kevinlinxc kevinlinxc force-pushed the mfa-required-surpassed-threshold branch from 003b189 to b5d0dbc Compare July 18, 2022 17:08
@kevinlinxc
Copy link
Contributor Author
kevinlinxc commented Jul 18, 2022

Removed the strong_mfa_level? check, and rebase/squashed

@kevinlinxc
Copy link
Contributor Author
kevinlinxc commented Jul 18, 2022

@sonalkr132

I've reverted to keep the strong_mfa_level? check.
One test actually fails otherwise: If a strong mfa user has >180 million downloads, mfa_recommended? should return false, but actually returns true because:

mfa_required? is false because of strong_mfa_level? being true, and then the rubygems.mfa_recommended.any? returns true because 180mil+1 > 165 mil.

A different approach could be to make the scope 165million..180million, but it would be easier to keep strong_mfa_level? check in mfa_recommended? in my opinion. What is your opinion?

Renamed  existing mfa_required functions (pertaining to the metadata of gems) to be metadata_mfa_required.
Added public interfaces that make use of mfa_required.
Added tests
@aellispierce aellispierce merged commit 037bb4d into rubygems:master Jul 21, 2022
@rubygems-org-shipit rubygems-org-shipit bot temporarily deployed to staging August 3, 2022 17:40 Inactive
@rubygems-org-shipit rubygems-org-shipit bot temporarily deployed to production August 3, 2022 17:45 Inactive
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.

6 participants

0