Fix bug saving GitHub tokens from other servers

This fixes a bug introduced in 076cb14, wherein we discarded tokens received
from other servers, and wherein we could save tokens with invalid
identification.

The bug was raised by Paul Melnikow.
This commit is contained in:
Thaddee Tyl
2017-11-11 10:27:24 +01:00
parent 28947dc89e
commit 59c0662874

View File

@@ -104,9 +104,9 @@ function setRoutes(server) {
});
server.route(/^\/github-auth\/add-token$/, function(data, match, end, ask) {
if (constEq(data.shieldsSecret, serverSecrets.shieldsSecret)) {
// An unknown entity tries to connect. Let the connection linger for a minute.
return setTimeout(function() { end('Invalid secret.'); }, 60000);
if (!constEq(data.shieldsSecret, serverSecrets.shieldsSecret)) {
// An unknown entity tries to connect. Let the connection linger for 10s.
return setTimeout(function() { end('Invalid secret.'); }, 10000);
}
addGithubToken(data.token);
end('Thanks!');