You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Charles Honton (JIRA)" <ji...@apache.org> on 2015/07/14 07:01:04 UTC

[jira] [Updated] (LANG-1076) SystemUtils.getSystemProperty(String property) - use doPrivileged?

     [ https://issues.apache.org/jira/browse/LANG-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charles Honton updated LANG-1076:
---------------------------------
    Component/s: lang.*

> SystemUtils.getSystemProperty(String property) - use doPrivileged?
> ------------------------------------------------------------------
>
>                 Key: LANG-1076
>                 URL: https://issues.apache.org/jira/browse/LANG-1076
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>            Reporter: Sebb
>
> COLLECTIONS-538 suggests fetching Properties should be done from a doPrivileged() block.
> I think this would help in the case where LANG is trusted, but is being called from code that is not trusted.
> If so, then it looks like the following code could be used:
> {code}
> try {
> // WAS: return System.getProperty(property);
>         return java.security.AccessController.doPrivileged(
>                 new java.security.PrivilegedAction<String>() {
>                     public String run() {
>                         return System.getProperty(property);
>                     }
>                 }
>              );
> } catch (final SecurityException ex) {
> etc.
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)