Test security policy

Hi, I want to set a security policy file. My current setup, but it’s not working I can still read etc/passwd:

apply plugin: 'java'
  test {
  systemProperties << ['java.security.policy': file("$projectDir/security.policy").absolutePath]
}

My policy:

grant codeBase "file:/vagrant/-" {
    permission java.io.FilePermission "/home/-", "read,write";
};

I want to prevent access to any resource (files, network, …)

You shouldn’t use left shift operator when setting the system property:

test {
  systemProperties ['java.security.policy': file("$projectDir/security.policy").absolutePath]
}

The way you had it the property was not set at all.