Skip to content

Commit

Permalink
COLDBOX-1247 #resolve
Browse files Browse the repository at this point in the history
Do not expose restful handler exception data unless you are in debug mode
  • Loading branch information
lmajano committed Oct 10, 2023
1 parent 281f179 commit d21f027
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions system/RestHandler.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ component extends="EventHandler" {
return;
}


// Log Exception
log.error(
"Error calling #arguments.event.getCurrentEvent()#: #arguments.exception.message# #arguments.exception.detail#",
Expand All @@ -563,7 +562,7 @@ component extends="EventHandler" {
// Setup General Error Response
arguments.prc.response
.setError( true )
.setData( {
.setData( inDebugMode() ? {
"environment" : {
"currentRoute" : arguments.event.getCurrentRoute(),
"currentRoutedUrl" : arguments.event.getCurrentRoutedUrl(),
Expand All @@ -576,7 +575,7 @@ component extends="EventHandler" {
"detail" : arguments.exception.detail,
"extendedInfo" : arguments.exception.extendedInfo
}
} )
} : {} )
.addMessage( "An exception ocurred: #arguments.exception.message#" )
.setStatusCode( arguments.event.STATUS.INTERNAL_ERROR )
.setStatusText( "General application error" );
Expand Down

0 comments on commit d21f027

Please sign in to comment.