From 0fd158ad3ee0e85a3c0d26f39b670ecccacc768a Mon Sep 17 00:00:00 2001 From: Bo Motlagh Date: Sun, 15 Jan 2023 17:36:01 -0500 Subject: [PATCH] adding a try/catch to saml2.coffee line 562 sign_request call - capturing error and returning in callback rather then allowing them to go uncaught --- lib/saml2.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/saml2.coffee b/lib/saml2.coffee index fcc1294..ea1c046 100644 --- a/lib/saml2.coffee +++ b/lib/saml2.coffee @@ -559,7 +559,9 @@ module.exports.ServiceProvider = return cb ex delete uri.search # If you provide search and query search overrides query :/ if options.sign_get_request - _.extend(uri.query, sign_request(deflated.toString('base64'), @private_key, options.relay_state)) + # adding this try/catch to stop async uncaught errors from passing through + try _.extend(uri.query, sign_request(deflated.toString('base64'), @private_key, options.relay_state)) + catch error then return cb(error) else uri.query.SAMLRequest = deflated.toString 'base64' uri.query.RelayState = options.relay_state if options.relay_state?