Skip to content

Commit 046f967

Browse files
zkatiarna
authored andcommitted
pacote: decode password before passing it on
1 parent 0d40bf3 commit 046f967

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/config/pacote.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
const BB = require('bluebird')
4+
const Buffer = require('safe-buffer').Buffer
45

56
const cp = require('child_process')
67
const npm = require('../npm')
@@ -60,7 +61,10 @@ function pacoteOpts (moreOpts) {
6061
if (key === '_authToken') {
6162
opts.auth[nerfDart].token = val
6263
} else if (key.match(/password$/i)) {
63-
opts.auth[nerfDart].password = val
64+
opts.auth[nerfDart].password =
65+
// the config file stores password auth already-encoded. pacote expects
66+
// the actual username/password pair.
67+
Buffer.from(val, 'base64').toString('utf8')
6468
} else if (key === 'always-auth') {
6569
opts.auth[nerfDart].alwaysAuth = val
6670
} else {

0 commit comments

Comments
 (0)