Protecting System Properties

Access to system properties (System.getProperty()) is controlled with a policy file (see Managing Policy Files). Here are examples of policy file entries for controlling access to system properties.
// grant all classes loaded from h1.com ability to read the `myprop' system properties grant codeBase "http://h1.com/-" { permission java.util.PropertyPermission "myprop", "read"; }; // grant ability to write the `myprop' system properties grant codeBase "http://h2.com/-" { permission java.util.PropertyPermission "myprop", "write"; }; // grant ability to read and write the `myprop' system properties grant codeBase "http://h3.com/-" { permission java.util.PropertyPermission "myprop", "read,write"; }; // grant ability to read all properties that start with `myprops.' grant codeBase "http://h4.com/-" { permission java.util.PropertyPermission "myprops.*", "read"; }; // grant ability to read all system properties grant codeBase "http://h5.com/-" { permission java.util.PropertyPermission "*", "read"; }; // grant ability to write all system properties grant codeBase "http://h6.com/-" { permission java.util.PropertyPermission "*", "write"; }; // grant ability to read and write all system properties grant codeBase "http://h7.com/-" { permission java.util.PropertyPermission "*", "read,write"; };

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.