-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
Option to disable 2FA #398
Comments
In my case it is somehow not detecting that my package already exists, and is public. So it actually publishes but then blows before it can push tags or open the release draft. Odd error handling |
@mikehardy Can you you open a separate issue detailing the specific problem you're experiencing? |
Sure thing - will be a couple days though, I lost the output on the last release I made, which would have made an ideal case, but I release that module every couple days |
opened fresh issue as instructed #427 - would be nice to be able to disable 2FA so I could push through, thus my interest in this issue |
An other use case is for packages that are published by different people, who cannot use 2FA. |
The current workaround is |
I think I've got module.exports = {
// Avoids `np` trying to set 2FA again and again
// after publishing to NPM
exists: true
} Without that, the 2FA gets triggered, but with it nope. Hopefully:
|
Another workaround: To stop /* package.json */
{
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
} Context: I also tried to use |
I create a PR to add the |
Why are you using lerna and np? Doesn't sound like a good use case.
This sounds incorrect. Every member who has access can also use 2FA. Also 2FA is already bypassable by using tokens — if your I think the reasoning behind disabling 2FA is just that it's an extra step, but IMHO non-default tools like The whole community benefits from 2FA; use it. I also find it annoying, but as a user I feel safer if the packages I use are published only with 2FA. |
I'm not combing those, no.
I agree. Absolutely. But there are circumstances in which a developer may want an escape hatch, and
I can only answer for myself, and to me it has nothing to do with wanting to avoid an extra step. I would love to be able to always use 2FA. I tend to agree about your point about tools like --no-cleanup Now, |
Doesn't sound right either: As a matter of fact, some of my old packages don't have 2FA enabled.
You're right about this, I just don't see a valid use case listed in this thread so I default to "we don't want to bother with 2FA" |
What you're showing here is the per-package settings which states that, if the package requires 2FA, then 2FA is strictly required for anyone attempting to publish new versions of that package. That means that if someone who haven't activated 2FA in their NPM account attempts to publish that package, it will be rejected and they will have to setup 2FA for their NPM account. Now, activating 2FA on your account, however, means that you will always be prompted for OTPs when you publish any package - if you select "Authorization and publishing" as your 2FA mode, whether that package requires 2FA or not for publishing. So even though some of your old packages don't have 2FA enabled, you will still be asked for an OTP when you attempt to publish a new version of them - unless you have chosen to only use 2FA for authentication and not publishing in your NPM account settings |
No, you can choose that. For example you can enable "Authorization only" and you'll be prompted for OTPs:
If you intend to publish packages without 2FA in your organization, just don't force it on your whole account. I just tried this and:
|
That's exactly what I wrote :-) If you select "Authorization and Publishing", you will be asked for an OTP, no matter the settings of that package. It will be required. However, if deciding to only use it for "Authorization", as you do I would assume, I guess that yes, it would be possible to opt-in every package one would like to require 2FA for, and that way, it will actually be possible to combine 2FA publishing with non-2FA publishing. I think I'm gonna go ahead and do just that. Awesome! It's cool that you tested it out. It doesn't change anything in terms of me thinking this feature would be a welcome addition to Because I do think that since every or nearly every default behavior of |
Description
With
np
v5.0.0, 2FA is enabled by default for new packages. However, no option is exposed to disable 2FA.Lines 198-204 in
np/index.js
enables 2FA if the package doesn't exist in the registry and if it isn't private.2FA is definitely the right default, and I encourage everyone to use it. The thing is,
np
comes with a lot of great defaults, but it also comes with ways of opting out of them. For example:--no-cleanup
--no-tests
--yolo
--no-publish
--no-yarn
--no-release-draft
In the same vein, something like
--no-2fa
should be possible. Currently it feels like the odd omission from what is otherwise a quite flexible configuration.Possible implementation
I suggest exposing a
--no-2fa
CLI argument that avoids forcing 2FA for new packages.The text was updated successfully, but these errors were encountered: