From 47f5cb2e76752d64ac9324589791bb4c41b560ba Mon Sep 17 00:00:00 2001 From: yumeko Date: Fri, 21 Jul 2023 22:32:39 +0300 Subject: [PATCH] Don't leak error details (including the stack trace) upon API call failure to client in production --- packages/backend/src/server/api/api-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/api-handler.ts b/packages/backend/src/server/api/api-handler.ts index 99a12fd110..770d5ac6f6 100644 --- a/packages/backend/src/server/api/api-handler.ts +++ b/packages/backend/src/server/api/api-handler.ts @@ -33,7 +33,7 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => code: y!.code, id: y!.id, kind: y!.kind, - ...(y!.info ? { info: y!.info } : {}), + ...((y!.info && process.env.NODE_ENV !== "production") ? { info: y!.info } : {}), }, }; } else {