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 Jul 8, 2024
1 parent ff12904 commit 28fc5a7
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.openmrs.api.APIAuthenticationException;
import org.openmrs.api.context.Context;
import org.openmrs.ui.framework.UiFrameworkException;
import org.openmrs.ui.framework.WebConstants;
import org.openmrs.ui.framework.page.FileDownload;
Expand All @@ -26,6 +27,7 @@
import org.openmrs.ui.framework.session.Session;
import org.openmrs.ui.framework.session.SessionFactory;
import org.openmrs.ui.util.ExceptionUtil;
import org.openmrs.util.PrivilegeConstants;
import org.owasp.encoder.Encode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -117,6 +119,7 @@ public String handlePath(String path, HttpServletRequest request, HttpServletRes
}
PageRequest pageRequest = new PageRequest(providerName, pageName, request, response, session);
try {
Context.addProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);
String html = pageFactory.handle(pageRequest);
model.addAttribute("html", html);
return SHOW_HTML_VIEW;
Expand Down Expand Up @@ -175,6 +178,9 @@ public String handlePath(String path, HttpServletRequest request, HttpServletRes

return "/module/uiframework/uiError";
}
finally {
Context.removeProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);
}
}

private void setRedirectUrl(HttpServletRequest request) {
Expand Down

0 comments on commit 28fc5a7

Please sign in to comment.