From 5ea8b07fbe7ba36799746e90e5540aeb85350183 Mon Sep 17 00:00:00 2001 From: ColaFanta <44313748+ColaFanta@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:57:36 +0800 Subject: [PATCH 1/2] Change use of `debug` from as constructor to call directly --- lib/shared/authorization_error_handler.js | 6 +++--- lib/shared/error_handler.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/shared/authorization_error_handler.js b/lib/shared/authorization_error_handler.js index fdfb58756..8642c2b79 100644 --- a/lib/shared/authorization_error_handler.js +++ b/lib/shared/authorization_error_handler.js @@ -6,9 +6,9 @@ import errOut from '../helpers/err_out.js'; import resolveResponseMode from '../helpers/resolve_response_mode.js'; import oneRedirectUriClients from '../actions/authorization/one_redirect_uri_clients.js'; -const debug = new Debug('oidc-provider:authentication:error'); -const serverError = new Debug('oidc-provider:server_error'); -const serverErrorTrace = new Debug('oidc-provider:server_error:trace'); +const debug = Debug('oidc-provider:authentication:error'); +const serverError = Debug('oidc-provider:server_error'); +const serverErrorTrace = Debug('oidc-provider:server_error:trace'); export default (provider) => { const AD_ACTA_CHECKS = Object.entries({ diff --git a/lib/shared/error_handler.js b/lib/shared/error_handler.js index 6fda69d2b..5c205fd6d 100644 --- a/lib/shared/error_handler.js +++ b/lib/shared/error_handler.js @@ -7,9 +7,9 @@ import * as formHtml from '../helpers/user_code_form.js'; import { ReRenderError } from '../helpers/re_render_errors.js'; import errOut from '../helpers/err_out.js'; -const debug = new Debug('oidc-provider:error'); -const serverError = new Debug('oidc-provider:server_error'); -const serverErrorTrace = new Debug('oidc-provider:server_error:trace'); +const debug = Debug('oidc-provider:error'); +const serverError = Debug('oidc-provider:server_error'); +const serverErrorTrace = Debug('oidc-provider:server_error:trace'); const userInputRoutes = new Set(['code_verification', 'device_resume']); From 73a40f9c9f2e163f7eec516eb1deadfc884b2b1d Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Thu, 16 Oct 2025 14:13:36 +0200 Subject: [PATCH 2/2] fixup! Change use of `debug` from as constructor to call directly --- certification/runner/debug.js | 4 ++-- lib/shared/authorization_error_handler.js | 10 +++++----- lib/shared/error_handler.js | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/certification/runner/debug.js b/certification/runner/debug.js index ceb6b9b89..5646c023a 100644 --- a/certification/runner/debug.js +++ b/certification/runner/debug.js @@ -1,7 +1,7 @@ -import Debug from 'debug'; +import debug from 'debug'; if (!('DEBUG' in process.env)) { process.env.DEBUG = 'runner'; } -export default new Debug('runner'); +export default debug('runner'); diff --git a/lib/shared/authorization_error_handler.js b/lib/shared/authorization_error_handler.js index 8642c2b79..b62889e07 100644 --- a/lib/shared/authorization_error_handler.js +++ b/lib/shared/authorization_error_handler.js @@ -1,4 +1,4 @@ -import Debug from 'debug'; +import debug from 'debug'; import { InvalidRedirectUri } from '../helpers/errors.js'; import instance from '../helpers/weak_cache.js'; @@ -6,9 +6,9 @@ import errOut from '../helpers/err_out.js'; import resolveResponseMode from '../helpers/resolve_response_mode.js'; import oneRedirectUriClients from '../actions/authorization/one_redirect_uri_clients.js'; -const debug = Debug('oidc-provider:authentication:error'); -const serverError = Debug('oidc-provider:server_error'); -const serverErrorTrace = Debug('oidc-provider:server_error:trace'); +const debugError = debug('oidc-provider:authentication:error'); +const serverError = debug('oidc-provider:server_error'); +const serverErrorTrace = debug('oidc-provider:server_error:trace'); export default (provider) => { const AD_ACTA_CHECKS = Object.entries({ @@ -25,7 +25,7 @@ export default (provider) => { if (err.expose) { provider.emit('authorization.error', ctx, err); - debug('%o', out); + debugError('%o', out); } else { provider.emit('server_error', ctx, err); serverError('path=%s method=%s error=%o', ctx.path, ctx.method, err); diff --git a/lib/shared/error_handler.js b/lib/shared/error_handler.js index 5c205fd6d..330145325 100644 --- a/lib/shared/error_handler.js +++ b/lib/shared/error_handler.js @@ -1,15 +1,15 @@ import * as crypto from 'node:crypto'; -import Debug from 'debug'; +import debug from 'debug'; import instance from '../helpers/weak_cache.js'; import * as formHtml from '../helpers/user_code_form.js'; import { ReRenderError } from '../helpers/re_render_errors.js'; import errOut from '../helpers/err_out.js'; -const debug = Debug('oidc-provider:error'); -const serverError = Debug('oidc-provider:server_error'); -const serverErrorTrace = Debug('oidc-provider:server_error:trace'); +const debugError = debug('oidc-provider:error'); +const serverError = debug('oidc-provider:server_error'); +const serverErrorTrace = debug('oidc-provider:server_error:trace'); const userInputRoutes = new Set(['code_verification', 'device_resume']); @@ -26,7 +26,7 @@ export default function getErrorHandler(provider, eventName) { ctx.status = err.statusCode || 500; if (err.expose && !(err instanceof ReRenderError)) { - debug('path=%s method=%s error=%o detail=%s', ctx.path, ctx.method, out, err.error_detail); + debugError('path=%s method=%s error=%o detail=%s', ctx.path, ctx.method, out, err.error_detail); } else if (!(err instanceof ReRenderError)) { serverError('path=%s method=%s error=%o', ctx.path, ctx.method, err); serverErrorTrace(err);