Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2017-05-26 01:00:27 +0300
committerRebecca Turner <me@re-becca.org>2017-05-26 04:55:34 +0300
commit046f967630935592a0da2f7a68de1ec55b481533 (patch)
tree5cb42ff5e11ab30784c84c74616c673a18d31755 /lib
parent0d40bf3e69a8db739213a5fd14f6e997dccb4838 (diff)
pacote: decode password before passing it on
Diffstat (limited to 'lib')
-rw-r--r--lib/config/pacote.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/config/pacote.js b/lib/config/pacote.js
index 42a98b7d2..43c5300fc 100644
--- a/lib/config/pacote.js
+++ b/lib/config/pacote.js
@@ -1,6 +1,7 @@
'use strict'
const BB = require('bluebird')
+const Buffer = require('safe-buffer').Buffer
const cp = require('child_process')
const npm = require('../npm')
@@ -60,7 +61,10 @@ function pacoteOpts (moreOpts) {
if (key === '_authToken') {
opts.auth[nerfDart].token = val
} else if (key.match(/password$/i)) {
- opts.auth[nerfDart].password = val
+ opts.auth[nerfDart].password =
+ // the config file stores password auth already-encoded. pacote expects
+ // the actual username/password pair.
+ Buffer.from(val, 'base64').toString('utf8')
} else if (key === 'always-auth') {
opts.auth[nerfDart].alwaysAuth = val
} else {