Skip to content

Commit

Permalink
TRUNK-6203: Global properties access should be privileged
Browse files Browse the repository at this point in the history
  • Loading branch information
dkayiwa committed Aug 8, 2024
1 parent ed17026 commit a788bfa
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,15 @@ public static SimpleObject wrapErrorResponse(Exception ex, String reason) {
StackTraceElement[] stackTraceElements = ex.getStackTrace();
if (stackTraceElements.length > 0) {
StackTraceElement stackTraceElement = ex.getStackTrace()[0];
String stackTraceDetailsEnabledGp = Context.getAdministrationService()
.getGlobalPropertyValue(RestConstants.ENABLE_STACK_TRACE_DETAILS_GLOBAL_PROPERTY_NAME, "false");
String stackTraceDetailsEnabledGp = null;
try {
Context.addProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);
stackTraceDetailsEnabledGp = Context.getAdministrationService()
.getGlobalPropertyValue(RestConstants.ENABLE_STACK_TRACE_DETAILS_GLOBAL_PROPERTY_NAME, "false");
}
finally {
Context.removeProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);
}
map.put("code", stackTraceElement.getClassName() + ":" + stackTraceElement.getLineNumber());
if ("true".equalsIgnoreCase(stackTraceDetailsEnabledGp)) {
map.put("detail", ExceptionUtils.getStackTrace(ex));
Expand Down

0 comments on commit a788bfa

Please sign in to comment.