Skip to content

Commit

Permalink
HV-1284 Re-enable security manager for local TCK execution
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarmorling authored and gsmet committed Mar 15, 2017
1 parent f704f03 commit f59d87d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 24 deletions.
1 change: 1 addition & 0 deletions documentation/src/main/asciidoc/ch01.asciidoc
Expand Up @@ -99,6 +99,7 @@ The following shows how to do this via a http://docs.oracle.com/javase/8/docs/te
grant codeBase "file:path/to/hibernate-validator-{hvVersion}.jar" {
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "setContextClassLoader";
// Only needed when working with XML descriptors (validation.xml or XML constraint mappings)
permission java.util.PropertyPermission "mapAnyUriToUri", "read";
Expand Down
28 changes: 4 additions & 24 deletions tck-runner/pom.xml
Expand Up @@ -167,8 +167,10 @@
</property>
</activation>
<properties>
<!-- The properties "arquillian.protocol" and "surefire.argLine" are set based on this setting via GMaven-->
<with-security-manager>true</with-security-manager>
<!-- Use Local for testing without security manager -->
<arquillian.protocol>LocalSecurityManagerTesting</arquillian.protocol>
<!-- Remove for testing without security manager -->
<maven-surefire-plugin.argLine>-Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/test.policy -Djava.security.debug=access</maven-surefire-plugin.argLine>
</properties>
<dependencies>
<dependency>
Expand All @@ -179,28 +181,6 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<executions>
<execution>
<id>configure-properties</id>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<scripts>
<script><![CDATA[
project.properties['arquillian.protocol'] = Boolean.valueOf(project.properties['with-security-manager']) ? 'LocalSecurityManagerTesting' : 'Local';
project.properties['surefire.argLine'] = Boolean.valueOf(project.properties['with-security-manager']) ? '-Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/test.policy -Djava.security.debug=access' : '';
]]>
</script>
</scripts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions tck-runner/src/test/resources/test.policy
Expand Up @@ -26,6 +26,7 @@
grant codeBase "file:${localRepository}/org/hibernate/hibernate-validator/${project.version}/hibernate-validator-${project.version}.jar" {
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "setContextClassLoader";

// JAXB
permission java.util.PropertyPermission "mapAnyUriToUri", "read";
Expand All @@ -36,6 +37,7 @@ grant codeBase "file:${localRepository}/org/hibernate/hibernate-validator/${proj
grant codeBase "file:${basedir}/../engine/target/hibernate-validator-${project.version}.jar" {
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "setContextClassLoader";

// JAXB
permission java.util.PropertyPermission "mapAnyUriToUri", "read";
Expand Down

0 comments on commit f59d87d

Please sign in to comment.