-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support OTP fetching from config.otpUrl #176
Conversation
Note: this does not yet assert that the OTP was actually sent over to npm.
Maybe I'm missing something here but that seems to be a huge security hole... |
No, they cannot release anything, because a) I need to press a button on my phone (although I'll admit that someone could configure a server to respond without that, however that's no worse than no 2FA at all) |
Also the URL should be kept as secret as the token (i.e. in env). I can easily update this to only use |
Reading through the documentation of https://github.com/nearform/optic I don't think using it require any modification in this plugin. In your CI you could simply set Because the OTP is valid only for a few seconds you could do that via a {
"scripts": {
"prepublishOnly": "export NPM_CONFIG_OTP=$(curl -s $NPM_OTP_URL/$OTP_TOKEN)"
}
} I would rather not make any change in this plugin not recommending any particular solution in the doc out of security concern. |
I was not aware you could set it this way - I'll try that out, thank you. I will try this out and report back. I have no intent of recommending any particular solution, but if this approach works - I suppose some documentation is in order - I'll see if I can find a place to PR that. |
No luck: https://travis-ci.org/dominykas/allow-scripts/jobs/575685664#L310 I suspected this might happen, because I had tried playing around with env vars in a different context - they don't carry through, i.e. npm does not see an env vars from one of I'll try writing the otp into an No luck: https://travis-ci.org/dominykas/allow-scripts/jobs/575690340#L316 It can probably be worked around by using the No luck with exec: https://travis-ci.org/dominykas/allow-scripts/jobs/576303090#L347 I might not be writing the param correctly or it is unsupported via the The only way I could get the env var to work was to set it directly before calling Edit: also just realized that setting it before executing Would it make sense to replace |
(merged two comments into one) |
In your first test the error is |
The link I have points to line 310 in the log... but the log does not contain such a line. The release job also ran 1.5 hours later than the test jobs, so I suspect for whatever reason (quite possibly by accident) I restarted the build. I can't find a way to recover the original logs, but I'm fairly certain it was an Reproducing the whole test is time consuming, but here's an alternative test case to demonstrate that env vars do not carry through:
package.json:
|
Closing per #234 (comment) |
Tested on one of my own packages: works like magic!
I think I got the coverage right, but I'm still not sure how to assert that
--otp
was passed through to npm. npm will send the OTP inside thenpm-otp
header, but short of adding a proxy around the couch app, I'm not sure if it's even possible to observe that in any way.See also: #93