commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Honton (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LANG-1076) SystemUtils.getSystemProperty(String property) - use doPrivileged?
Date Tue, 14 Jul 2015 05:01:04 GMT

     [ 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)

Mime
View raw message