Skip to content

Commit

Permalink
TRUNK-6203: Global properties access should be privileged (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
wikumChamith authored Jun 3, 2024
1 parent 981fccc commit 16bab70
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions omod/src/main/java/org/openmrs/web/servlet/LoginServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.openmrs.api.context.ContextAuthenticationException;
import org.openmrs.util.LocaleUtility;
import org.openmrs.util.OpenmrsConstants;
import org.openmrs.util.PrivilegeConstants;
import org.openmrs.web.OpenmrsCookieLocaleResolver;
import org.openmrs.web.WebConstants;
import org.openmrs.web.WebUtil;
Expand Down Expand Up @@ -81,8 +82,16 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
// look up the allowed # of attempts per IP
Integer allowedLockoutAttempts = 100;

String allowedLockoutAttemptsGP = Context.getAdministrationService().getGlobalProperty(
GP_ALLOWED_LOGIN_ATTEMPTS_PER_IP, "100");
String allowedLockoutAttemptsGP = "100";
try {
Context.addProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);
allowedLockoutAttemptsGP = Context.getAdministrationService().getGlobalProperty(
GP_ALLOWED_LOGIN_ATTEMPTS_PER_IP, "100");
}
finally {
Context.removeProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);
}

try {
allowedLockoutAttempts = Integer.valueOf(allowedLockoutAttemptsGP.trim());
}
Expand Down

0 comments on commit 16bab70

Please sign in to comment.