Skip to content

System.properties access restriction. #6636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aanton03 opened this issue Aug 27, 2019 · 2 comments · Fixed by #6637
Closed

System.properties access restriction. #6636

aanton03 opened this issue Aug 27, 2019 · 2 comments · Fixed by #6637

Comments

@aanton03
Copy link

I'm getting access denied ("java.util.PropertyPermission" "*" "read,write") error when using the IO Scheduler.

Its coming from:

Properties properties = System.getProperties();

static {
        Properties properties = System.getProperties();

        PurgeProperties pp = new PurgeProperties();
        pp.load(properties);

        PURGE_ENABLED = pp.purgeEnable;
        PURGE_PERIOD_SECONDS = pp.purgePeriod;

        start();
    }

All this seems to be from what I could see is that it's trying to get purge options from the system properties.

static final class PurgeProperties {

        boolean purgeEnable;

        int purgePeriod;

        void load(Properties properties) {
            if (properties.containsKey(PURGE_ENABLED_KEY)) {
                purgeEnable = Boolean.parseBoolean(properties.getProperty(PURGE_ENABLED_KEY));
            } else {
                purgeEnable = true;
            }

            if (purgeEnable && properties.containsKey(PURGE_PERIOD_SECONDS_KEY)) {
                try {
                    purgePeriod = Integer.parseInt(properties.getProperty(PURGE_PERIOD_SECONDS_KEY));
                } catch (NumberFormatException ex) {
                    purgePeriod = 1;
                }
            } else {
                purgePeriod = 1;
            }
        }
    }

In my system I can't allow for read/write access to all System properties. Can this be changed to use System.getProperty(PURGE_ENABLED_KEY) or the like as I can allow for access to specific keys.

@akarnokd
Copy link
Member

I'll look into it.

@akarnokd
Copy link
Member

Fix posted for 3.x and 2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants