EntityTestCase Test failures with Hibernate ORM when run under security manager

Description

Running two WildFly tests under Java Security Manager with Hibernate ORM 6.1.3 shows failure:

Caused by: java.security.AccessControlException: WFSM000001: Permission check failed (permission "("java.lang.RuntimePermission" "accessDeclaredMembers")" in code source "(vfs:/content/jpa_entitytest.jar <no signer certificates>)" of "ModuleClassLoader
for Module "deployment.jpa_entitytest.jar" from Service Module Loader")
       at org.wildfly.security.elytron-base@2.0.0.Beta3//org.wildfly.security.manager.WildFlySecurityManager.checkPermission(WildFlySecurityManager.java:309)
       at org.wildfly.security.elytron-base@2.0.0.Beta3//org.wildfly.security.manager.WildFlySecurityManager.checkPermission(WildFlySecurityManager.java:201)
       at java.base/java.lang.Class.checkMemberAccess(Class.java:2847)
       at java.base/java.lang.Class.getDeclaredMethod(Class.java:2471)
       at deployment.jpa_entitytest.jar//org.jboss.as.test.integration.jpa.hibernate.entity.Flight$HibernateProxy$nGaCISjH.<clinit>(Unknown Source)

 

To see Flight class constructor as generated bytecode, see https://gist.github.com/scottmarlow/2c602fcfa8512b904c4c0776a88b8152#file-gistfile1-txt-L513 (loaded entity proxy class was saved to disk via https://github.com/hibernate/hibernate-orm/pull/5308)

To recreate with WildFly:

Steps to use Scott's branch to reproduce wildfly test failure

git clone https://github.com/scottmarlow/wildfly
cd wildfly
git checkout WFLY-16713_Hibernate_ORM6.1.3
./build.sh clean install -DskipTests=true
pushd wildfly/testsuite/integration/basic
mvn clean test -Dtest=SessionFactoryTestCase -Dsecurity.manager
mvn clean test -Dtest=EntityTestCase -Dsecurity.manager
popd

 

Recreate the failure with a debugger

pushd dist/target/wildfly-27.0.0.Beta1-SNAPSHOT/bin
vim standalone.conf
find line with #JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"
save your changes to standalone.conf
./standalone.sh -secmgr &
popd
pushd wildfly/testsuite/integration/basic
mvn clean test -Dtest=EntityTestCase -Dsecurity.manager
popd

Activity

Show:
Fixed

Details

Assignee

Reporter

Worked in

Components

Fix versions

Affects versions

Priority

Created September 15, 2022 at 5:42 PM
Updated October 5, 2022 at 10:02 AM
Resolved September 22, 2022 at 2:49 PM

Flag notifications