Skip to content

Commit 9eab2cb

Browse files
committed
Fix token passing
1 parent 8e9c3cb commit 9eab2cb

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

server.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ http.createServer(function(req, resp) {
8181
//resp.end('ok2');
8282
headers["Authorization"] = "token " + process.env.TRAVIS_TOKEN;
8383
var json = JSON.parse(jsonString);
84-
var cipherText = publicKey.encrypt("GITHUB_TOKEN=" + json.request.config.env.global[3], undefined, undefined, rsa.RSA_PKCS1_PADDING);
85-
var secvar = cipherText.toString('base64');
84+
var cipherTextLogin = publicKey.encrypt("GITHUB_NAME=" + json.login, undefined, undefined, rsa.RSA_PKCS1_PADDING);
85+
var login = cipherTextLogin.toString('base64');
86+
var cipherText = publicKey.encrypt("GITHUB_TOKEN=" + json.request.config.env.global[3].secure, undefined, undefined, rsa.RSA_PKCS1_PADDING);
87+
var token = cipherText.toString('base64');
8688
request({
8789
url: 'https://api.travis-ci.org/repo/' + process.env.GITHUB_NAME + '%2Fhttpse/requests',
8890
method: req.method,
@@ -94,9 +96,11 @@ http.createServer(function(req, resp) {
9496
"env": {
9597
"global": [
9698
"DOMAIN=" + json.state,
97-
"GITHUB_NAME=" + json.login,
99+
{
100+
"secure": login
101+
},
98102
"ISSUE=" + 3, {
99-
"secure": secvar
103+
"secure": token
100104
}
101105
]
102106
}

0 commit comments

Comments
 (0)