Skip to content

Commit

Permalink
[SHRINKRES-42] Access sysprops in a secure fashion
Browse files Browse the repository at this point in the history
  • Loading branch information
ALRubinger committed Dec 17, 2012
1 parent 49e803a commit c12993f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public MavenWorkingSession execute(final MavenWorkingSession session) {
}

final SettingsBuildingRequest request = new DefaultSettingsBuildingRequest()
.setSystemProperties(System.getProperties())
.setSystemProperties(SecurityActions.getProperties())
.setUserSettingsFile(settingsXmlFile);
final MavenWorkingSession newSession = session.execute(request);
return newSession.regenerateSession();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,12 @@ public String run() {

static Properties getProperties() {
try {
Properties value = AccessController.doPrivileged(new PrivilegedExceptionAction<Properties>() {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Properties>() {
@Override
public Properties run() {
return System.getProperties();
}
});
return value;
}
// Unwrap
catch (final PrivilegedActionException pae) {
Expand Down

3 comments on commit c12993f

@kpiwko
Copy link
Member

@kpiwko kpiwko commented on c12993f Dec 17, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@gastaldi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Isn't this already being done inside System.getProperties() ? Why the need to check Security again ?

@mmatloka
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties operations are example in AccessController javadoc so I would assume it is needed here.

Please sign in to comment.