Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-10142

Some Naming tests fail with security manager with JDK 9

    Details

    • Steps to Reproduce:
      Hide

      cd wildfly/testsuite/integration/basic
      mvn clean test -Dtest=LdapUrlInSearchBaseTestCase,ExternalContextBindingTestCase -Dsecurity.manager

      Show
      cd wildfly/testsuite/integration/basic mvn clean test -Dtest=LdapUrlInSearchBaseTestCase,ExternalContextBindingTestCase -Dsecurity.manager

      Description

      Tests

      • LdapUrlInSearchBaseTestCase
      • ExternalContextBindingTestCase

      fail with security manager because of missing permission "java.lang.RuntimePermission" "accessClassInPackage.com.sun.jndi.ldap", with exception like:

      ERROR [io.undertow.request] (default task-2) UT005023: Exception handling request to /ldap-test/: javax.servlet.ServletException: javax.naming.NamingException: WFLYNAM0027: Failed instantiate InitialContextFactory com.sun.jndi.ldap.LdapCtxFactory from classloader ModuleClassLoader for Module "deployment.ldap-test.war" from Service Module Loader [Root exception is java.security.AccessControlException: WFSM000001: Permission check failed (permission "("java.lang.RuntimePermission" "accessClassInPackage.com.sun.jndi.ldap")" in code source "(vfs:/W:/workspace/eap-7x-as-testsuite-test-integ-windows-secman/be5b5ebd/testsuite/integration/basic/content/ldap-test.war/WEB-INF/classes <no signer certificates>)" of "ModuleClassLoader for Module "deployment.ldap-test.war" from Service Module Loader")]
      	at deployment.ldap-test.war//org.jboss.as.test.integration.naming.ldap.LdapUrlTestServlet.doGet(LdapUrlTestServlet.java:75)
      	at javax.servlet.api//javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      	at javax.servlet.api//javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
      	at io.undertow.servlet//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:67)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      	at org.wildfly.extension.undertow//org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.servlet//io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      	at io.undertow.servlet//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
      	at io.undertow.servlet//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
      	at io.undertow.servlet//io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at org.wildfly.extension.undertow//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at org.wildfly.extension.undertow//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
      	at io.undertow.servlet//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
      	at io.undertow.servlet//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      	at org.wildfly.extension.undertow//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
      	at org.wildfly.extension.undertow//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1526)
      	at org.wildfly.extension.undertow//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1526)
      	at org.wildfly.extension.undertow//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1526)
      	at org.wildfly.extension.undertow//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1526)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletInitialHandler$1$1.run(ServletInitialHandler.java:110)
      	at java.base/java.security.AccessController.doPrivileged(Native Method)
      	at io.undertow.servlet//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:107)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
      	at io.undertow.core@2.0.0.SP1-redhat-1//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
      	at org.jboss.threads@2.3.1.Final-redhat-1//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads@2.3.1.Final-redhat-1//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
      	at org.jboss.threads@2.3.1.Final-redhat-1//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
      	at org.jboss.threads@2.3.1.Final-redhat-1//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
      	at java.base/java.lang.Thread.run(Thread.java:844)
      Caused by: javax.naming.NamingException: WFLYNAM0027: Failed instantiate InitialContextFactory com.sun.jndi.ldap.LdapCtxFactory from classloader ModuleClassLoader for Module "deployment.ldap-test.war" from Service Module Loader [Root exception is java.security.AccessControlException: WFSM000001: Permission check failed (permission "("java.lang.RuntimePermission" "accessClassInPackage.com.sun.jndi.ldap")" in code source "(vfs:/W:/workspace/eap-7x-as-testsuite-test-integ-windows-secman/be5b5ebd/testsuite/integration/basic/content/ldap-test.war/WEB-INF/classes <no signer certificates>)" of "ModuleClassLoader for Module "deployment.ldap-test.war" from Service Module Loader")]
      	at org.jboss.as.naming//org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:120)
      	at org.jboss.as.naming//org.jboss.as.naming.InitialContext.init(InitialContext.java:101)
      	at java.naming/javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:154)
      	at org.jboss.as.naming//org.jboss.as.naming.InitialContext.<init>(InitialContext.java:91)
      	at org.jboss.as.naming//org.jboss.as.naming.InitialContextFactory.getInitialContext(InitialContextFactory.java:43)
      	at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:730)
      	at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
      	at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
      	at java.naming/javax.naming.InitialContext.<init>(InitialContext.java:208)
      	at java.naming/javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:101)
      	at deployment.ldap-test.war//org.jboss.as.test.integration.naming.ldap.LdapUrlTestServlet.runSearch(LdapUrlTestServlet.java:109)
      	at deployment.ldap-test.war//org.jboss.as.test.integration.naming.ldap.LdapUrlTestServlet.doGet(LdapUrlTestServlet.java:73)
      	... 45 more
      Caused by: java.security.AccessControlException: WFSM000001: Permission check failed (permission "("java.lang.RuntimePermission" "accessClassInPackage.com.sun.jndi.ldap")" in code source "(vfs:/W:/workspace/eap-7x-as-testsuite-test-integ-windows-secman/be5b5ebd/testsuite/integration/basic/content/ldap-test.war/WEB-INF/classes <no signer certificates>)" of "ModuleClassLoader for Module "deployment.ldap-test.war" from Service Module Loader")
      	at org.wildfly.security.elytron-private@1.2.4.Final-redhat-1//org.wildfly.security.manager.WildFlySecurityManager.checkPermission(WildFlySecurityManager.java:295)
      	at org.wildfly.security.elytron-private@1.2.4.Final-redhat-1//org.wildfly.security.manager.WildFlySecurityManager.checkPermission(WildFlySecurityManager.java:192)
      	at java.base/java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1534)
      	at org.wildfly.security.elytron-private@1.2.4.Final-redhat-1//org.wildfly.security.manager.WildFlySecurityManager.checkPackageAccess(WildFlySecurityManager.java:491)
      	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:181)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
      	at java.base/java.lang.Class.forName0(Native Method)
      	at java.base/java.lang.Class.forName(Class.java:375)
      	at org.jboss.modules.JDKSpecific$1.loadClassLocal(JDKSpecific.java:115)
      	at org.jboss.modules.Module.loadModuleClass(Module.java:717)
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      	at java.base/java.lang.Class.forName0(Native Method)
      	at java.base/java.lang.Class.forName(Class.java:375)
      	at org.jboss.as.naming//org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:115)
      	... 56 more
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  honza889 Jan Kalina
                  Reporter:
                  olukas Ondrej Lukas
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: