From cd0254b29988f08f6a5aed96bc45ea581962d5d7 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Thu, 18 Jan 2024 15:57:59 -0500 Subject: [PATCH 1/2] chore(prod): switch to using edge tag [no ci] --- epivar-prod/docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epivar-prod/docker-compose.yml b/epivar-prod/docker-compose.yml index e5a7cbb3..81500023 100644 --- a/epivar-prod/docker-compose.yml +++ b/epivar-prod/docker-compose.yml @@ -2,7 +2,7 @@ services: # Common ------------------------------------------------------------------------------------------------------------- epivar-portal: - image: ghcr.io/c3g/epivar-portal:pr-15 + image: ghcr.io/c3g/epivar-portal:edge ports: - 80:80 depends_on: @@ -18,7 +18,7 @@ services: # Node 1: hg19 data -------------------------------------------------------------------------------------------------- epivar-node-1-server: - image: ghcr.io/c3g/epivar-server:pr-15 + image: ghcr.io/c3g/epivar-server:edge networks: - epivar-node-1-server-net - epivar-node-1-redis-net @@ -79,7 +79,7 @@ services: # Node 2: hg38 data (lifted over) ------------------------------------------------------------------------------------ epivar-node-2-server: - image: ghcr.io/c3g/epivar-server:pr-15 + image: ghcr.io/c3g/epivar-server:edge networks: - epivar-node-2-server-net - epivar-node-2-redis-net From bf816cdf93042062665e2aa49620507204dc55fc Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Thu, 18 Jan 2024 16:28:40 -0500 Subject: [PATCH 2/2] fix: don't leak command failed errors + remove stack returns --- helpers/handlers.mjs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/helpers/handlers.mjs b/helpers/handlers.mjs index 5706b413..6541627b 100644 --- a/helpers/handlers.mjs +++ b/helpers/handlers.mjs @@ -3,15 +3,27 @@ */ +const GENERIC_MESSAGE = + "An error was encountered while processing this request. See the server logs for more information."; + export const errorHandler = (res, status=500) => err => { if (status) { res.status(status); } if (err instanceof Error) { - res.json({ok: false, status, message: err.toString(), stack: err.stack.split('\n')}); + let message = err.toString(); + console.error(`Error encountered (status=${status}): ${message}; stack:\n`, err.stack); + if (message.startsWith("Error: Command failed:")) { + message = GENERIC_MESSAGE; + } + res.json({ok: false, status, message}); } else { - res.json({ok: false, status, message: err}); + let message = err; + if (message.startsWith("Error: Command failed:")) { + message = GENERIC_MESSAGE; + } + res.json({ok: false, status, message}); } res.end(); };