OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.16k stars 599 forks source link

ACE seen in com.ibm.websphere.monitor.meters.MeterCollection #19292

Closed tevans78 closed 3 years ago

tevans78 commented 3 years ago

This was seen during local testing of MP Open Tracing. During a full build the exception may get swallowed but we should still add the do-priv to MeterCollection

[08/11/2021, 14:03:09:509 GMT] 00000043 kernel.launch.internal.MissingDoPrivDetectionSecurityManager W CWWKE0921W: Current Java 2 Security policy reported a potential violation of Java 2 Security Permission. The application needs to have permissions addedPermission: 
("javax.management.MBeanPermission" "com.ibm.ws.jaxrs.monitor.REST_Stats#-[WebSphere:name=opentracing/org.eclipse.microprofile.opentracing.tck.application.TestServerWebServices/asyncLocalSpan(jakarta.ws.rs.container.AsyncResponse),type=REST_Stats]" "registerMBean")
Stack: 
java.security.AccessControlException: Access denied ("javax.management.MBeanPermission" "com.ibm.ws.jaxrs.monitor.REST_Stats#-[WebSphere:name=opentracing/org.eclipse.microprofile.opentracing.tck.application.TestServerWebServices/asyncLocalSpan(jakarta.ws.rs.container.AsyncResponse),type=REST_Stats]" "registerMBean")java.base/java.security.AccessController.throwACE(AccessController.java:176)
java.base/java.security.AccessController.checkPermissionHelper(AccessController.java:238)
java.base/java.security.AccessController.checkPermission(AccessController.java:385)
java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:322)
com.ibm.ws.kernel.launch.internal.MissingDoPrivDetectionSecurityManager.checkPermission(MissingDoPrivDetectionSecurityManager.java:45)
java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.checkMBeanPermission(DefaultMBeanServerInterceptor.java:1787)
java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:317)
java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
com.ibm.ws.kernel.boot.jmx.service.MBeanServerForwarderDelegate.registerMBean(MBeanServerForwarderDelegate.java:221)
com.ibm.ws.jmx.internal.DelayedMBeanActivator.registerMBean(DelayedMBeanActivator.java:662)
com.ibm.ws.kernel.boot.jmx.internal.PlatformMBeanServer.registerMBean(PlatformMBeanServer.java:435)
com.ibm.websphere.monitor.meters.MeterCollection.MXBeanHelper(MeterCollection.java:121)
com.ibm.websphere.monitor.meters.MeterCollection.put(MeterCollection.java:74)
com.ibm.ws.jaxrs.monitor.JaxRsMonitorFilter.initJaxRsStats(JaxRsMonitorFilter.java:251)
com.ibm.ws.jaxrs.monitor.JaxRsMonitorFilter.filter(JaxRsMonitorFilter.java:153)
org.jboss.resteasy.core.interception.jaxrs.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:361)
org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:252)
org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:101)
org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:74)
org.jboss.resteasy.core.SynchronousDispatcher.asynchronousDelivery(SynchronousDispatcher.java:540)
org.jboss.resteasy.core.AbstractAsynchronousResponse.internalResume(AbstractAsynchronousResponse.java:205)
org.jboss.resteasy.plugins.server.servlet.Servlet3AsyncHttpRequest$Servlet3ExecutionContext$Servle3AsychronousResponse.resume(Servlet3AsyncHttpRequest.java:90)
org.eclipse.microprofile.opentracing.tck.application.TestServerWebServices.asyncLocalSpan(TestServerWebServices.java:218)
tevans78 commented 3 years ago

Probably here: https://github.com/OpenLiberty/open-liberty/blob/15001b6550df376fec53b07accf0ebb493a4aab1/dev/com.ibm.ws.monitor/src/com/ibm/websphere/monitor/meters/MeterCollection.java#L121