commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew P. Del Buono (JIRA)" <>
Subject [jira] Created: (LOGGING-130) Potential missing privileged block for class loader
Date Wed, 06 May 2009 01:57:30 GMT
Potential missing privileged block for class loader

                 Key: LOGGING-130
             Project: Commons Logging
          Issue Type: Bug
    Affects Versions: 1.1.1
         Environment: Windows 7 under Sun JRE 6 Update 13, 64-bit
Running Commons HttpClient 3,1 w/ Commons Logging 1.1.1
            Reporter: Matthew P. Del Buono

When attempting to instantiate a HttpClient, a call to LogFactory.getLog() is made. Going
deeper, Commons Logging later attempts to make an unprivileged call to java.lang.ClassLoader.getParent().
Under systems with an installed SecurityManager (like mine), this may be forbidden.

In particular, this call will require the RuntimePermission getClassLoader. In my particular
case, I am attempting to sandbox specific segments of code, and thus cannot grant this permission
to the user of HttpClient (and, thus, Commons Logging). However, I feel that Commons Logging
should be able to trust itself to make a self-checked call to ClassLoader.getParent().

The stack trace for my situation (trimmed off to assist you) is as follows:

Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.SecurityException:
Cannot request this permission from a tainted execution path (Caused by java.lang.SecurityException:
Cannot request this permission from a tainted execution path)
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
	at org.apache.commons.logging.LogFactory.getLog(
	at org.apache.commons.httpclient.HttpClient.<clinit>(
	... 11 more
Caused by: java.lang.SecurityException: Cannot request this permission from a tainted execution
	at com.mmoui.manager.MinionSecurityManager.verifyUntainted(
	at com.mmoui.manager.MinionSecurityManager.checkPermission(
	at com.mmoui.manager.MinionSecurityManager.checkPermission(
	at java.lang.ClassLoader.getParent(
	at org.apache.commons.logging.impl.LogFactoryImpl.getLowestClassLoader(
	at org.apache.commons.logging.impl.LogFactoryImpl.getBaseClassLoader(
	at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(
	at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
	... 15 more

I feel that LogFactoryImpl.getLowestClassLoader's call to java.lang.ClassLoader.getParent()
should be wrapped by AccessController.doPrivileged(). I can't think of any reason not to do
this currently. This would allow my application to trust Commons Logging and not have to grant
the RuntimePermission getClassLoader to the users of HttpClient.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message