Skip to content

Commit

Permalink
log cleanup, redeploy after changing expired Rollbar Project Access T…
Browse files Browse the repository at this point in the history
…okens
  • Loading branch information
suculent committed Nov 8, 2023
1 parent 2b5080e commit 2b40b09
Show file tree
Hide file tree
Showing 16 changed files with 1 addition and 58 deletions.
4 changes: 0 additions & 4 deletions lib/router.auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ module.exports = function (app) {
return Util.failureResponse(res, 403, "wrapper error");
}

console.log("PerformTokenLogin get result (should be valid):", {userWrapper});

let wrapper = JSON.parse(userWrapper);

let owner_id;
Expand Down Expand Up @@ -106,8 +104,6 @@ module.exports = function (app) {
req.session.cookie.secure = false; // allows HTTP login
req.session.cookie.httpOnly = true;

console.log("🔨 [debug] redirecting with session...");

Util.respond(res, { "redirectURL": "/app" });
});
});
Expand Down
10 changes: 0 additions & 10 deletions lib/router.github.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,13 @@ module.exports = function (app) {
function validateGithubUser(response, token, userWrapper) {

let owner_id = userWrapper.owner; // must not be nil
console.log("[oauth][github] searching for owner with ID: ", { owner_id });

// Check user and make note on user login
userlib.get(userWrapper.owner, (error, udoc) => {

// Error case covers creating new user/managing deleted account
if (error) {

// Error is expected when user is not found, this is just for exploration:
// console.log("[oauth][github] userlib.get failed with error: ", error, { udoc });

if (error.toString().indexOf("Error: deleted") !== -1) {
console.log("🔨 [debug] [oauth] [check] user document deleted");
response.redirect(
Expand Down Expand Up @@ -97,7 +93,6 @@ module.exports = function (app) {

alog.log(owner_id, "OAuth User created. ");

console.log("validateGithubUser", { token }, { userWrapper });
app.redis_client.v4.set(token, JSON.stringify(userWrapper));
app.redis_client.v4.expire(token, 30);

Expand Down Expand Up @@ -125,7 +120,6 @@ module.exports = function (app) {
}

const ourl = app_config.public_url + "/auth.html?t=" + token + "&g=" + gdpr; // require GDPR consent
console.log("[validateGithubUser] using response with ourl: " + ourl);
response.redirect(ourl);
}); // userlib.get
}
Expand Down Expand Up @@ -197,8 +191,6 @@ module.exports = function (app) {
return;
}

console.log("🔨 [debug] [oauth] [github] access_token", access_token);

if ((!access_token) || (access_token.indexOf("bad_verification") !== -1)) {
console.log("🔨 [debug] [github] [token] No token, exiting.");
original_response.status(401).end();
Expand All @@ -216,8 +208,6 @@ module.exports = function (app) {
}
};

console.log("🔨 [debug] [github] [token] getting user info with", JSON.stringify(requestOptions));

https.get(requestOptions, (res) => {
let data = '';
res.on('data', (chunk) => {
Expand Down
2 changes: 0 additions & 2 deletions lib/router.google.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ module.exports = function (app) {
if (failOnDeletedAccountDocument(error, ores)) return;
if (failOnDeletedAccount(udoc, ores)) return;

//console.log("[processGoogleCallbackError] Userlib get OTHER error: " + error.toString());

// In case the document is undefined (and identity confirmed by Google), create new one...
if (typeof (udoc) === "undefined" || udoc === null) {
console.log("Setting session owner from Google User Wrapper...");
Expand Down
2 changes: 0 additions & 2 deletions lib/router.slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ module.exports = function (app) {

var areq = https.get(options, function (res) {

// console.log("🔨 [debug] [slack] /redirect GET status", res.statusCode); == 200

var bodyChunks = [];
if (typeof (res) === "undefined" || (res == null) || res.statusCode == 403) {
console.log("🔨 [debug] [slack] No response.");
Expand Down
3 changes: 0 additions & 3 deletions lib/thinx/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,6 @@ module.exports = class Builder {
copy.secret = "****"; // mask secrets in log
}

// DO NOT LEAK REMOTE ENV VARS!
// console.log("called runRemoteShell with job", copy);

if (this.io !== null) {
this.io.emit('job', job);
} else {
Expand Down
2 changes: 0 additions & 2 deletions lib/thinx/gdpr.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ module.exports = class GDPR {
) {
this.owner.sendGDPRExpirationEmail24(user, user.email, () => {
this.userlib.atomic("users", "edit", user.owner, { notifiedBeforeGDPRRemoval24: true }, (uerror) => {
//console.log("📤 [info] sendGDPRExpirationEmail24", uerror, abody);
opt_callback(uerror);
opt_callback = null; // to prevent double call
});
Expand All @@ -97,7 +96,6 @@ module.exports = class GDPR {
) {
this.owner.sendGDPRExpirationEmail168(user, user.email, () => {
this.userlib.atomic("users", "edit", user.owner, { notifiedBeforeGDPRRemoval168: true }, (uerror) => {
//console.log("📤 [info] sendGDPRExpirationEmail168", uerror, abody);
if (typeof (opt_callback) !== "undefined") {
opt_callback(uerror);
opt_callback = null; // to prevent double call
Expand Down
1 change: 0 additions & 1 deletion lib/thinx/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ module.exports = class Git {
let askpath = this.askpath(keypath);
var gfpfx = `ssh-agent sh -c 'DISPLAY=: SSH_ASKPASS=${askpath} GIT_ASKPASS=${askpath} ssh-add ${keypath} >/dev/null 2>&1; `;
let prefixed_command = gfpfx + command + "' 2>&1";
//console.log("[REMOVEME] [git fetch] trying command:", prefixed_command); // REMOVE THIS!
this.create_askfile(keypath, "thinx"); // TODO: per-owner/per-key keypass stored in Vault
success = this.tryShellOp(prefixed_command, local_path);
this.delete_askfile(keypath);
Expand Down
2 changes: 1 addition & 1 deletion lib/thinx/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ module.exports = class Statistics {
atLeastOneFileFound = true;

var jsonData = fs.readFileSync(wpath).toString();
console.log("🔨 [debug] jsonData", jsonData, "\nfrom", wpath );

var data = JSON.parse(jsonData);
if ((typeof (data) === "undefined") || (data === null)) continue;

Expand Down
2 changes: 0 additions & 2 deletions spec/jasmine/02-OwnerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ describe("Owner", function () {
console.log("(01) Creating user", user_body);

user.create(user_body, true, res_mock, (_res, success, response) => {

//console.log("[DEBUG] user.create response", { _res}, {success}, {response});

// valid case is existing user as well
if (typeof (response) == "string" && response.indexOf("username_already_exists") !== -1) {
Expand Down
2 changes: 0 additions & 2 deletions spec/jasmine/TransferSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ describe("Transfer", function () {
devices.list(envi.oid, (success, response) => {
expect(success).to.equal(true);
expect(response).to.be.a('object');
//console.log("[spec] [transfer] BEFORE device list:", JSON.stringify(response, null, 2));
});
});

afterAll((done) => {
devices.list(envi.oid, (success, response) => {
expect(success).to.equal(true);
expect(response).to.be.a('object');
//console.log("[spec] [transfer] AFTER device list:", JSON.stringify(response, null, 2));
done();
});
console.log(`🚸 [chai] <<< completed Transfer spec`);
Expand Down
8 changes: 0 additions & 8 deletions spec/jasmine/ZZ-AppSessionUserV2DeleteSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ describe("User Routes V2", function () {
expect(__res.status).to.equal(200);
expect(__res.text).to.be.a('string'); // <html>
expect(__res).to.be.html;
//console.log("🚸 [chai] IMPORTANT(2)", __res.text);

chai.request(thx.app)
.post('/api/v2/password/set')
Expand All @@ -76,7 +75,6 @@ describe("User Routes V2", function () {
expect(___res.status).to.equal(200);
expect(___res.text).to.be.a('string');
expect(___res.text).to.equal('{"success":true,"response":"activation_successful"}');
//console.log("🚸 [chai] IMPORTANT(3)", ___res.text);
done();
});
});
Expand Down Expand Up @@ -105,7 +103,6 @@ describe("User Routes V2", function () {
.get('/api/v2/password/reset?owner_id='+envi.dynamic2.owner+'&reset_key='+reset_key)
.end((_err, res) => {
expect(res.status).to.equal(200);
//console.log("GET /api/v2/password/reset res text", res.text);
// should include "Enter your new password"
expect(res.text).to.be.a('string');
done();
Expand Down Expand Up @@ -185,7 +182,6 @@ describe("User Routes V2", function () {
.post('/api/login')
.send({ username: "dynamic2", password: "dynamic3" })
.end((_err1, res1) => {
//console.log("🚸 [chai] POST /api/login response:", res1.text, "status", res1.status);
expect(res1.status).to.equal(401);
expect(res1.text).to.equal('{"success":false,"response":"password_mismatch"}');
done();
Expand All @@ -197,7 +193,6 @@ describe("User Routes V2", function () {
.get('/api/v2/stats')
.set('Authorization', jwt)
.end((_err, res) => {
//console.log("🚸 [chai] V2 GET /api/v2/stats response", res.text);
expect(res.status).to.equal(200);
expect(res.text).to.be.a('string');
expect(res.text).to.equal('{"success":false,"response":"no_results"}');
Expand All @@ -211,7 +206,6 @@ describe("User Routes V2", function () {
.set('Authorization', jwt)
.send({})
.end((_err, res) => {
//console.log("🚸 [chai] V2 POST /api/v2/chat response:", res.text, " status:", res.status);
expect(res.status).to.equal(200);
expect(res.text).to.be.a('string');
expect(res.text).to.equal('{"success":true,"response":"no_slack_channel"}');
Expand Down Expand Up @@ -244,7 +238,6 @@ describe("User Routes V2", function () {
.get('/api/v2/logout')
.set('Authorization', jwt)
.end((_err, res) => {
//console.log("🚸 [chai] V2 GET /api/v2/logout response", res.text); // expect redirect
expect(res.status).to.equal(200);
expect(res).to.be.html;
done();
Expand All @@ -261,7 +254,6 @@ describe("User Routes V2", function () {
.end((_err, res) => {
console.log("🚸 [chai] V2 DELETE /api/v2/user response:", res.text, " status:", res.status);
expect(res.status).to.equal(200);
//expect(res.text).to.be.a('string');
done();
});
}, 30000);
Expand Down
1 change: 0 additions & 1 deletion spec/jasmine/ZZ-RouterBuilderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ describe("Builder (JWT)", function () {
.set('Authorization', jwt)
.send({ udid: envi.dynamic.udid, build_id: envi.build_id })
.end((err, res) => {
//console.log("🚸 [chai] response /api/v2/build/artifacts (JWT, no-owner):", res.text, " status:", res.status);
expect(res.status).to.equal(400);
done();
});
Expand Down
9 changes: 0 additions & 9 deletions spec/jasmine/ZZ-RouterDeviceAPISpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ describe("Device + API (JWT+Key)", function () {
.post('/api/login')
.send({ username: 'dynamic', password: 'dynamic', remember: false })
.then(function (res) {
// console.log(`[chai] Transformer (JWT) beforeAll POST /api/login (valid) response: ${JSON.stringify(res)}`);
expect(res).to.have.cookie('x-thx-core');
let body = JSON.parse(res.text);
jwt = 'Bearer ' + body.access_token;
Expand Down Expand Up @@ -193,7 +192,6 @@ describe("Device + API (JWT+Key)", function () {
.set('Authentication', ak)
.send({ registration: {} })
.end((err, res) => {
//console.log("🚸 [chai] POST /device/register (jwt, invalid body) response", res.text, res.status);
expect(res.status).to.equal(400);
expect(res.text).to.be.a('string');
let j = JSON.parse(res.text);
Expand Down Expand Up @@ -342,7 +340,6 @@ describe("Device + API (JWT+Key)", function () {
.set('Authorization', jwt)
.send({ udid: JRS6.udid })
.end((err, res) => {
// console.log("🚸 [chai] POST /api/device/detail (jwt, valid) response:", res.text, " status:", res.status);
expect(res.status).to.equal(200);
expect(res.text).to.be.a('string');
done();
Expand Down Expand Up @@ -442,10 +439,6 @@ describe("Device + API (JWT+Key)", function () {
.send({ udid: envi.udid })
.end((err, res) => {
console.log("🚸 [chai] POST /api/device/detail (session, udid) 2 response:", res.text, " status:", res.status);
//expect(res.status).to.equal(401);
//expect(res.text).to.be.a('string');
//let j = JSON.parse(res.text);
//console.log("[spec] [chai] detail:", JSON.stringify(j, null, 2));
done();
});
}, 30000);
Expand All @@ -456,8 +449,6 @@ describe("Device + API (JWT+Key)", function () {
.send({ changes: { alias: "edited-alias" } })
.end((err, res) => {
console.log("🚸 [chai] POST /api/device/edit (session, invalid) response:", res.text, " status:", res.status);
//expect(res.status).to.equal(200);
//expect(res.text).to.be.a('string');
done();
});
}, 30000);
Expand Down
1 change: 0 additions & 1 deletion spec/jasmine/ZZ-RouterDeviceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ describe("Devices (JWT)", function () {
.set('Authorization', jwt)
.send({ udid: JRS5.udid })
.end((_err, res) => {
//console.log("🚸 [chai] POST /api/device/detach (JWT) 2 response:", res.text, " status:", res.status);
expect(res.status).to.equal(200);
expect(res.text).to.be.a('string');
expect(res.text).to.equal('{"success":true,"response":"detached"}');
Expand Down
1 change: 0 additions & 1 deletion spec/jasmine/ZZ-RouterTransferSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ describe("Transfer (JWT)", function () {
.set('Authorization', jwt)
.send({ udids: [envi.dynamic.udid], transfer_id: transfer_id, owner: envi.dynamic.owner }) // will probably need real device using GET /api/device
.end((_err, res) => {
//console.log(`🚸 [chai] POST /api/v2/transfer/accept III response: ${res.text}`); // returns HTML
expect(res.status).to.equal(200);
expect(res.text).to.be.a('string');
done();
Expand Down
9 changes: 0 additions & 9 deletions thinx-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,6 @@ module.exports = class THiNX extends EventEmitter {
saveUninitialized: false
};

//console.log("Running core with sessionConfig", sessionConfig)

// intentionally exposed cookie because there is no HTTPS between app and Traefik frontend
const sessionParser = session(sessionConfig); /* lgtm [js/missing-token-validation] */

Expand Down Expand Up @@ -426,8 +424,6 @@ module.exports = class THiNX extends EventEmitter {
}
}

console.log("ℹ️ [info] WS Session is parsed, handling protocol upgrade...");

if (typeof (socketMap.get(owner)) === "undefined") {

socketMap.set(owner, socket);
Expand All @@ -446,10 +442,6 @@ module.exports = class THiNX extends EventEmitter {
});
});

function heartbeat() {
// console.log("[Socket] heartbeat."); // better store this.lastAlive = new Date(); in InfluxDB
}

setInterval(function ping() {
if (typeof (wss.clients) !== "undefined") {
wss.clients.forEach(function each(ws) {
Expand Down Expand Up @@ -522,7 +514,6 @@ module.exports = class THiNX extends EventEmitter {
// Type: initial socket
} else if (typeof (object.init) !== "undefined") {
if (typeof (msgr) !== "undefined") {
console.log(`ℹ️ [info] [ws] Initializing new messenger in WS...`);
var owner = object.init;
let socket = app._ws[owner];
msgr.initWithOwner(owner, socket, (success, message_z) => {
Expand Down

0 comments on commit 2b40b09

Please sign in to comment.