[ mx4j-Bugs-1116450 ] spec ambiguity? security check for getDomains()
"SourceForge.net" <[email protected]>
| Newsgroups | gmane.comp.java.mx4j.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #1116450, was opened at 2005-02-04 12:23
Message generated for change (Settings changed) made by jboynes
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=450647&aid=1116450&group_id=47745
Category: JMX implementation
Group: None
>Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Jeremy Boynes (jboynes)
Assigned to: Jeremy Boynes (jboynes)
Summary: spec ambiguity? security check for getDomains()
Initial Comment:
Currently MBS.getDomains() does not perform any
security check which is a bug. However, the JavaDoc for
J2SE1.5 and J2EE1.4 are different.
The JavaDoc for J2SE1.5 says:
For the getDomains method, the caller's permissions
must imply MBeanPermission(null, null, name,
"getDomains"). Additionally, for each domain d in the
returned array, if the caller's permissions do not
imply MBeanPermission(null, null, new
ObjectName("d:x=x"), "getDomains"), the domain is
eliminated from the array. Here, x=x is any key=value
pair, needed to satisfy ObjectName's constructor but
not otherwise relevant.
For J2EE1.4:
For the getDomains method, the caller's permissions
must imply MBeanPermission(null, null, name,
"getDomains"). Additionally, for each domain d in the
returned array, if the caller's permissions do not
imply MBeanPermission(null, null, new
ObjectName("d:x=x"), "queryMBeans"), the domain is
eliminated from the array. Here, x=x is any key=value
pair, needed to satisfy ObjectName's constructor but
not otherwise relevant.
Note difference between "getDomains" and "queryMBeans"
Moreover, JDK1.5 seems to first check for
(null,null,null, "getDomains") and then for each
returned domain check (null, null, new
ObjectName(domain, "x", "x"), "getDomains")
Below is an impl of getDomains() that mimics JDK1.5.
public String[] getDomains()
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
{
sm.checkPermission(new MBeanPermission(null,
null, null, "getDomains"));
}
Set keys;
synchronized (domains)
{
keys = new HashSet(domains.keySet());
}
if (sm != null)
{
for (Iterator i = keys.iterator(); i.hasNext();)
{
String domain = (String) i.next();
try
{
ObjectName name = new ObjectName(domain,
"x", "x");
sm.checkPermission(new
MBeanPermission(null, null, name, "getDomains"));
} catch (SecurityException e)
{
i.remove();
continue;
} catch (MalformedObjectNameException e)
{
throw new AssertionError();
}
}
}
return (String[])keys.toArray(new
String[keys.size()]);
}
----------------------------------------------------------------------
Comment By: Jeremy Boynes (jboynes)
Date: 2005-02-07 23:14
Message:
Logged In: YES
user_id=378919
Applied patch and added testcase
----------------------------------------------------------------------
Comment By: Eamonn McManus (emcmanus)
Date: 2005-02-07 02:31
Message:
Logged In: YES
user_id=770046
This was an error in the original JMX spec v1.2. See:
<http://java.sun.com/products/JavaManagement/jmx-1.2-errata.html#getdomains>
Of course the check is against "getDomains", not "queryMBeans".
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=450647&aid=1116450&group_id=47745
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click