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 72c638d commit 534c75e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
2 changes: 1 addition & 1 deletion documentation/src/main/asciidoc/ch01.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,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 Expand Up @@ -321,4 +322,3 @@ To learn more about the validation of beans and properties, just continue readin
<<chapter-bean-constraints>>. If you are interested in using Bean Validation for the validation of
method pre- and postcondition refer to <<chapter-method-constraints>>. In case your application has
specific validation requirements have a look at <<validator-customconstraints>>.

28 changes: 4 additions & 24 deletions tck-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,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 @@ -183,28 +185,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
Original file line number Diff line number Diff line change
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 534c75e

Please sign in to comment.