Permission Analysis Report


Analysis of: org.eclipse.core.runtime

Detail

Class: org.eclipse.core.internal.preferences.DefaultPreferences (Application)
DoPrivileged location: Line# 255 void applyProductDefaults( )
Permission: java.lang.RuntimePermission "getClassLoader"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: java.lang.RuntimePermission "modifyThread"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: java.net.NetPermission "specifyStreamHandler"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: java.net.SocketPermission "???host???", "resolve"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: java.net.SocketPermission "???host???:???port???", "connect"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: java.net.SocketPermission "localhost", "resolve"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: java.net.SocketPermission "localhost:1024-", "resolve"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: java.net.SocketPermission "localhost:1024-:???port???", "connect"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: java.net.SocketPermission "localhost:???port???", "connect"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: java.util.PropertyPermission "java.protocol.handler.pkgs", "read"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: org.osgi.framework.ServicePermission "", ""
Primordial/void java.net.URL.URL( java.lang.String )
Permission: org.osgi.framework.ServicePermission "", "get"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: org.osgi.framework.ServicePermission "java.net.ContentHandler", ""
Primordial/void java.net.URL.URL( java.lang.String )
Permission: org.osgi.framework.ServicePermission "java.net.ContentHandler", "get"
Primordial/void java.net.URL.URL( java.lang.String )
Permission: org.osgi.framework.ServicePermission "org.osgi.service.url.URLStreamHandlerService", ""
Primordial/void java.net.URL.URL( java.lang.String )
Permission: org.osgi.framework.ServicePermission "org.osgi.service.url.URLStreamHandlerService", "get"
Primordial/void java.net.URL.URL( java.lang.String )


CODE
private void applyProductDefaults() { // prime the cache the first time if (productCustomization == null) { IProduct product = Platform.getProduct(); if (product == null) { if (InternalPlatform.DEBUG_PREFERENCE_GENERAL) Policy.debug("Product not available to set product default preference overrides."); //$NON-NLS-1$ return; } String id = product.getId(); if (id == null) { if (InternalPlatform.DEBUG_PREFERENCE_GENERAL) Policy.debug("Product ID not available to apply product-level preference defaults."); //$NON-NLS-1$ return; } Bundle bundle = product.getDefiningBundle(); if (bundle == null) { if (InternalPlatform.DEBUG_PREFERENCE_GENERAL) Policy.debug("Bundle not available to apply product-level preference defaults for product id: " + id); //$NON-NLS-1$ return; } String value = product.getProperty(PRODUCT_KEY); URL url = null; URL transURL = null; if (value == null) { if (InternalPlatform.DEBUG_PREFERENCE_GENERAL) Policy.debug("Product : " + id + " does not define preference customization file. Using legacy file: plugin_customization.ini"); //$NON-NLS-1$//$NON-NLS-2$ value = LEGACY_PRODUCT_CUSTOMIZATION_FILENAME; url = Platform.find(bundle, new Path(LEGACY_PRODUCT_CUSTOMIZATION_FILENAME)); transURL = Platform.find(bundle, NL_DIR.append(value).removeFileExtension().addFileExtension(PROPERTIES_FILE_EXTENSION)); } else { // try to convert the key to a URL try { url = new URL(value);
} catch (MalformedURLException e) {
// didn't work so treat it as a filename
url = Platform.find(bundle, new Path(value));
if (url != null)
transURL = Platform.find(bundle, NL_DIR.append(value).removeFileExtension().addFileExtension(PROPERTIES_FILE_EXTENSION));
}
}
if (url == null) {
if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
Policy.debug("Product preference customization file: " + value + " not found for bundle: " + id); //$NON-NLS-1$//$NON-NLS-2$
return;
}
if (transURL == null && InternalPlatform.DEBUG_PREFERENCE_GENERAL)
Policy.debug("No preference translations found for product/file: " + bundle.getSymbolicName() + '/' + value); //$NON-NLS-1$

productCustomization = loadProperties(url);
productTranslation = loadProperties(transURL);
}
applyDefaults(null, productCustomization, productTranslation);
}

Tainted variable reference trace:

Permission Requirements:



Conclusion:

The caller should not need the above required permissions. This is private method and the best place to wrap is
the calling method as shown in the following:

private void loadDefaults() {
applyRuntimeDefaults();
applyBundleDefaults();
if(System.getSecurityManager() == null) {
applyProductDefaults();
} else {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
applyProductDefaults();
return null;
}
});
}
applyCommandLineDefaults();

}

Grant the above required permissions to this plug-in via OSGI-INF/permissions.perm file.

DoPrivileged location: Line# 349 java.util.Properties loadProperties( java.lang.String )
Permission: java.io.FilePermission "???file???", "read"
Primordial/void java.io.FileInputStream.FileInputStream( java.lang.String )


CODE
private Properties loadProperties(String filename) { Properties result = new Properties(); InputStream input = null; try { input = new BufferedInputStream(new FileInputStream(filename));
result.load(input);
} catch (FileNotFoundException e) {
if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
Policy.debug("Preference customization file not found: " + filename); //$NON-NLS-1$
} catch (IOException e) {
String message = NLS.bind(Messages.preferences_loadException, filename);
IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, e);
InternalPlatform.getDefault().log(status);
} finally {
if (input != null)
try {
input.close();
} catch (IOException e) {
// ignore
}
}
return result;
}

Tainted variable reference trace:

Permission Requirements:



Conclusion:

This method is eventually called by the loadDefaults method. See above conclusion.

Grant the above required permissions to this plug-in via OSGI-INF/permissions.perm file.

DoPrivileged location: Line# 350 java.util.Properties loadProperties( java.lang.String )
Permission: java.util.PropertyPermission "java.vendor.url.bug", "read"
Primordial/void java.util.Properties.load( java.io.InputStream )


CODE
private Properties loadProperties(String filename) { Properties result = new Properties(); InputStream input = null; try { input = new BufferedInputStream(new FileInputStream(filename)); result.load(input);
} catch (FileNotFoundException e) {
if (InternalPlatform.DEBUG_PREFERENCE_GENERAL)
Policy.debug("Preference customization file not found: " + filename); //$NON-NLS-1$
} catch (IOException e) {
String message = NLS.bind(Messages.preferences_loadException, filename);
IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, message, e);
InternalPlatform.getDefault().log(status);
} finally {
if (input != null)
try {
input.close();
} catch (IOException e) {
// ignore
}
}
return result;
}

Tainted variable reference trace:

Permission Requirements:



Conclusion:


This method is eventually called by the loadDefaults method. See above conclusion.

Grant the above required permissions to this plug-in via OSGI-INF/permissions.perm file.

DoPrivileged location: Line# 328 java.util.Properties loadProperties( java.net.URL )
Permission: java.util.PropertyPermission "java.vendor.url.bug", "read"
Primordial/void java.util.Properties.load( java.io.InputStream )


CODE
private Properties loadProperties(URL url) { Properties result = new Properties(); if (url == null) return result; InputStream input = null; try { input = url.openStream(); result.load(input);
} catch (IOException e) {
if (InternalPlatform.DEBUG_PREFERENCE_GENERAL) {
Policy.debug("Problem opening stream to preference customization file: " + url); //$NON-NLS-1$
e.printStackTrace();
}
} finally {
if (input != null)
try {
input.close();
} catch (IOException e) {
// ignore
}
}
return result;
}

Tainted variable reference trace:

Permission Requirements:



Conclusion:


This method is eventually called by the loadDefaults method. See above conclusion.

Grant the above required permissions to this plug-in via OSGI-INF/permissions.perm file.