From 33577bb2d5d2f131d525358885094bedcb80ae34 Mon Sep 17 00:00:00 2001 From: Kaj Kowalski Date: Tue, 10 Jun 2025 00:35:27 +0200 Subject: [PATCH] Potential fix for code scanning alert no. 6: Information exposure through a stack trace Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/index.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index 76dfc01..15c4b9a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -209,14 +209,17 @@ export default { }); } catch (error) { - console.error('Worker error:', error); - return new Response(JSON.stringify(formatError(error)), { - status: 500, - headers: { - 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*' + console.error('Worker error:', error); // Log full error details, including stack trace + return new Response( + JSON.stringify({ message: 'An internal server error occurred. Please try again later.' }), + { + status: 500, + headers: { + 'Content-Type': 'application/json', + 'Access-Control-Allow-Origin': '*' + } } - }); + ); } }, };