Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit 90782af

Browse files
committed
ensure github credentials are base64 encoded only
1 parent 88ec7da commit 90782af

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

github.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ function createRemoteStrings(auth, hostname) {
4646

4747
// avoid storing passwords as plain text in config
4848
function encodeCredentials(auth) {
49-
return new Buffer(encodeURIComponent(auth.username) + ':' + encodeURIComponent(auth.password)).toString('base64');
49+
return new Buffer(auth.username + ':' + auth.password).toString('base64');
5050
}
5151
function decodeCredentials(str) {
52-
var auth = new Buffer(str, 'base64').toString('ascii').split(':');
52+
var auth = new Buffer(str, 'base64').toString('utf8').split(':');
5353

5454
var username, password;
55+
5556
try {
5657
username = decodeURIComponent(auth[0]);
5758
password = decodeURIComponent(auth[1]);

0 commit comments

Comments
 (0)