From d01cd3eee5f33605232047b2b2f116319f643e8d Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 9 Oct 2023 12:26:49 +0000 Subject: [PATCH] fix: sanitise column name and alias name in single query --- .../global-exception/global-exception.filter.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/filters/global-exception/global-exception.filter.ts b/packages/nocodb/src/filters/global-exception/global-exception.filter.ts index 9dc8341e7d..e68b475037 100644 --- a/packages/nocodb/src/filters/global-exception/global-exception.filter.ts +++ b/packages/nocodb/src/filters/global-exception/global-exception.filter.ts @@ -21,7 +21,20 @@ export class GlobalExceptionFilter implements ExceptionFilter { const ctx = host.switchToHttp(); const response = ctx.getResponse(); - this.logger.error(exception.message, exception.stack); + // skip unnecessary error logging + if ( + process.env.NC_ENABLE_ALL_API_ERROR_LOGGING === 'true' || + !( + exception instanceof BadRequest || + exception instanceof AjvError || + exception instanceof Unauthorized || + exception instanceof Forbidden || + exception instanceof NotFound || + exception instanceof NotImplemented || + exception instanceof UnprocessableEntity + ) + ) + this.logger.error(exception.message, exception.stack); const dbError = extractDBError(exception);