From f4a465ea693695b1d89d1b931124e85388211c42 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 31 May 2016 11:49:51 +0100 Subject: [PATCH] Return a 'not authorized' error if the user is not logged in/authorized --- services/real-time/app/coffee/Router.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/real-time/app/coffee/Router.coffee b/services/real-time/app/coffee/Router.coffee index 9a055e0b86..c0e7313c39 100644 --- a/services/real-time/app/coffee/Router.coffee +++ b/services/real-time/app/coffee/Router.coffee @@ -21,9 +21,13 @@ module.exports = Router = attrs[key] = value attrs.client_id = client.id attrs.err = error - logger.error attrs, "server side error in #{method}" - # Don't return raw error to prevent leaking server side info - return callback {message: "Something went wrong in real-time service"} + if error.message == "not authorized" + logger.warn attrs, "client is not authorized" + return callback {message: error.message} + else + logger.error attrs, "server side error in #{method}" + # Don't return raw error to prevent leaking server side info + return callback {message: "Something went wrong in real-time service"} configure: (app, io, session) -> app.set("io", io) @@ -99,4 +103,4 @@ module.exports = Router = if err? Router._handleError callback, err, client, "applyOtUpdate", {doc_id, update} else - callback() \ No newline at end of file + callback()