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 Allow opt-in into requiring gem owners to setup 2FA by jzajpt · Pull Request #2242 · rubygems/rubygems.org · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content

Conversation

jzajpt
Copy link
Contributor
@jzajpt jzajpt commented Feb 29, 2020

This PR adds the ability to opt-in into requiring all gem owners to have enabled 2FA before performing the following actions:

  • Creating new gem
  • Pushing new gem version
  • Adding/removing owners
  • Yanking a version

Also, once enabled, Rubygems won't add any new owners to the gem who do not have 2FA already enabled.

The opt-in happens by adding gemspec's metadata option "rubygems_mfa_required" with any value ("true" used in the codebase here). It can be theoretically removed by yanking the version with the opt-in or pushing a new version without the option.

@jzajpt jzajpt changed the title Allow to opt-in into requiring 2FA Allow opt-in into requiring gem owners to setup 2FA Mar 1, 2020
end

def mfa_required?
versions.last&.rubygems_mfa_required?
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm trying to understand the versions.last&.rubygems_mfa_required? check.

Can you clarify, when you push a new version, which is the first version to set rubygems_mfa_required=true, does that version itself require MFA? Or would it only be the next and subsequent versions?

E.g.

  • v1.0 does not require MFA
  • v1.1 sets rubygems_mfa_required=true.
  • v1.2 will require MFA

Would v1.1 also require MFA? Assuming Rubygem#mfa_required? is checking against v1.0 which does not have rubygems_mfa_required=true.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @jzajpt. So continuing the example above, when v1.1 is about to be pushed, the latest version is v1.0 (rubygems_mfa_required=nil). Does this mean v1.1 would not require MFA?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eliotsykes Sorry, I deleted my original comment as I realized I had not answered your question. When you're pushing the first version withrubygems_mfa_required=true, then the push itself doesn't require MFA yet as the check happens on the latest available version, not the one you're pushing. Only any subsequent action will require it. I will add a test case to cover this scenario.

@ecnelises
Copy link
Member

Thanks for the great work! This is a nice feature, overall it looks good.

But I'm doubting if checking latest version's metadata is a clean way. Can we add this into gem settings page instead of setting them in gemspec?

@jzajpt
Copy link
Contributor Author
jzajpt commented Mar 3, 2020

@ecnelises I've got the idea to use metadata from the discussion on #2106. I quite like this approach, because there's no UI to edit any gem information on Rubygems.org at this time. But I am open to discussion.
One slight improvement might be to keep the MFA opt-in enabled once it's been set and to require actually setting it to "false" to turn it off...

@ecnelises
Copy link
Member

I've got the idea to use metadata from the discussion on #2106. I quite like this approach, because there's no UI to edit any gem information on Rubygems.org at this time. But I am open to discussion.

This idea is reasonable to me. Requiring mfa metadata to be set explicitly is fine, since currently we still see mfa disabled as default behavior. Now I have no idea how other pkg management systems do (npm, pypi, etc.), they might be good reference.

@jzajpt jzajpt marked this pull request as ready for review March 15, 2020 16:08
@sonalkr132 sonalkr132 force-pushed the enforce-mfa-on-create-owner branch 2 times, most recently from 80b25c2 to d2d0c47 Compare October 19, 2021 03:45
@sonalkr132
Copy link
Member

once enabled, Rubygems won't add any new owners to the gem who do not have 2FA already enabled.

I am not sure I understand the requirement for this. Setting rubygems_mfa_required does not mean that existing owners have enabled MFA. What additional value are we creating by impose this on new owners being added?
We have limits on all privileged ownership operations, does the requirement of the owner being adding having MFA provide any further guarantee not achieved by these limits. It will make adding a new owner cumbersome (for existing owners). We want to impose limitations on users (owners) who have not enabled MFA, oppose to the existing owner (who will perform owner add and see the error).
Our goal should not be that all owners enable MFA. Some users may choose to keep MFA disabled if they are not actively maintaining the gem with MFA requirements.

@sonalkr132 sonalkr132 force-pushed the enforce-mfa-on-create-owner branch from 38b49e7 to b6ddb47 Compare October 19, 2021 06:44
jzajpt and others added 3 commits October 23, 2021 07:17
Enforce MFA requirement when adding new owners

When metadata "rubygems_mfa_required" is present on the last version, rubygems will
make sure that new owners have enabled MFA before allowing to add them.

Check for MFA requirement when pushing new gems or new gem versions

Once the "rubygems_mfa_required" metadata flag is present, Rubygems.org will:

* not allow to add/remove any owners unless the user has MFA enabled
* not allow to add any owner who hasn't MFA enabled
* not allow to push new gem to users without MFA enabled
* not allow to push new versions to users without MFA enabled

Enforce MFA requirement when yanking versions

Fix Rubocop offenses

Reuse check for MFA requirement

Show information about MFA requirement on rubygems#show page

Add DE translations

Provide locale keys for all required translations

Refactor checking for MFA requirement

Use ActiveRecord's boolean cast to check for MFA opt-in

Add a test case to cover pushing a version that requires MFA first time

Fix Rubocop offense

Show a version number that introduced MFA requirement

Show only the latest version that introduced MFA requirement
Move mfa requirement check of current version to pusher

checking this in rubygems model meant that it would have returned even
when all versions of a gem was yanked.
@sonalkr132 sonalkr132 force-pushed the enforce-mfa-on-create-owner branch from 651dab2 to 19767e5 Compare October 23, 2021 01:56
We don't have much to gain by adding requirement of mfa being enabled
for owner being added. The new owner won't be able to perform any
action until they enable MFA anyway.
Added a test to add the process of disabling mfa requirement.
If mfa requirement is set, all versions (even with rubygems_mfa_required false)
will require OTP. Versions following rubygems_mfa_required => false
won't require OTP.
@sonalkr132 sonalkr132 force-pushed the enforce-mfa-on-create-owner branch from 19767e5 to 844e3c3 Compare October 23, 2021 02:18
@sonalkr132 sonalkr132 merged commit cbf0bc7 into rubygems:master Oct 23, 2021
@sonalkr132 sonalkr132 temporarily deployed to staging October 25, 2021 11:05 Inactive
@sonalkr132 sonalkr132 temporarily deployed to production October 26, 2021 12:58 Inactive
@flavorjones
Copy link

I think this is a great feature, thank you! Are there plans to update the Gem Specification docs at https://guides.rubygems.org/specification-reference/ to explain how to use this gemspec metadata?

@sonalkr132
Copy link
Member

@flavorjones see rubygems/guides#297.

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