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 Jun 26, 2024
1 parent 95051a0 commit 4df6afd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/src/main/java/org/openmrs/web/filter/GZIPFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.openmrs.api.APIException;
import org.openmrs.api.context.Context;
import org.openmrs.util.OpenmrsConstants;
import org.openmrs.util.PrivilegeConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.filter.OncePerRequestFilter;
Expand Down Expand Up @@ -124,6 +125,8 @@ private boolean isGZIPEnabled() {
}

try {
Context.addProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);

String gzipEnabled = Context.getAdministrationService().getGlobalProperty(
OpenmrsConstants.GLOBAL_PROPERTY_GZIP_ENABLED, "");

Expand All @@ -137,6 +140,9 @@ private boolean isGZIPEnabled() {

return false;
}
finally {
Context.removeProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);
}
}

/**
Expand Down

0 comments on commit 4df6afd

Please sign in to comment.