Colon in URL throws exception when trying to find non-existent module layout

Description

This has been an ongoing issue for us since at least Coldbox 5 and possibly before. I couldn't reproduce it in a stock Commandbox + Coldbox environment until recently.

We added (and then removed) a module in a folder called referees with an entrypoint of refs. We restarted Lucee so the folder is completely gone. Then we tried this URL:

http://127.0.0.1:56779/refs:Main/Index

and got this:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 Event: refs:Main.Index Route: :handler/:action/ Route Name: N/A Routed Module: N/A Routed Namespace: N/A Routed URL: refs:Main/Index/ Layout: Main.cfm (Module: ) View: Main/Index Timestamp: 08/28/2019 07:51:13 AM Type: expression Messages: key [refs] doesn't exist (existing keys:HTMLHelper) Tag Context: Template: F:\dev\temp\coldbox\system\web\Renderer.cfc LINE: 664: parentModuleLayoutPath = "/#variables.appMapping#/#variables.layoutsConvention#/modules/#moduleName#/#arguments.layout#"; 665: parentCommonLayoutPath = "/#variables.appMapping#/#variables.layoutsConvention#/modules/#arguments.layout#"; 666: moduleLayoutPath = "#variables.modulesConfig[moduleName].mapping#/#variables.modulesConfig[moduleName].conventions.layoutsLocation#/#arguments.layout#"; 667: 668: // Check parent view order setup Template: F:\dev\temp\coldbox\system\web\Renderer.cfc LINE: 584: } else { 585: lock name="#cbox_layoutLocationKey#.#lockname#" type="exclusive" timeout="15" throwontimeout="true"{ 586: cbox_layoutLocation = cbox_locateUDF( layout=cbox_currentLayout, module=arguments.module, explicitModule=cbox_explicitModule ); 587: structInsert( controller.getSetting( "layoutsRefMap" ), cbox_layoutLocationKey, cbox_layoutLocation, true ); 588: } Template: F:\dev\temp\coldbox\system\Bootstrap.cfc LINE: 284: else { 285: renderedContent = cbcontroller.getRenderer() 286: .renderLayout( module=event.getCurrentLayoutModule(), viewModule=event.getCurrentViewModule() ); 287: } 288: Template: F:\dev\temp\coldbox\system\Bootstrap.cfc LINE: 470: // Process A ColdBox Request Only 471: if( findNoCase( 'index.cfm', listLast( arguments.targetPage, '/' ) ) ){ 472: processColdBoxRequest(); 473: } 474: return true; Template: F:\dev\temp\Application.cfc LINE: 42: public boolean function onRequestStart( string targetPage ){ 43: // Process ColdBox Request 44: application.cbBootstrap.onRequestStart( arguments.targetPage ); 45: 46: return true; Stack Trace: lucee.runtime.exp.ExpressionException: key [refs] doesn't exist (existing keys:HTMLHelper) at lucee.commons.collection.AbstractMapPro.invalidKey(AbstractMapPro.java:754) at lucee.commons.collection.concurrent.ConcurrentHashMapPro$Segment.getE(ConcurrentHashMapPro.java:358) at lucee.commons.collection.concurrent.ConcurrentHashMapPro.g(ConcurrentHashMapPro.java:824) at lucee.runtime.type.StructImpl.get(StructImpl.java:128) at lucee.runtime.type.util.StructSupport.get(StructSupport.java:242) at lucee.runtime.util.VariableUtilImpl.get(VariableUtilImpl.java:267) at lucee.runtime.util.VariableUtilImpl.getCollection(VariableUtilImpl.java:261) at lucee.runtime.PageContextImpl.getCollection(PageContextImpl.java:1479) at coldbox.system.web.renderer_cfc$cf.udfCall1(/coldbox/system/web/Renderer.cfc:666) at coldbox.system.web.renderer_cfc$cf.udfCall(/coldbox/system/web/Renderer.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:205) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:778) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:846) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1726) at coldbox.system.web.renderer_cfc$cf.udfCall1(/coldbox/system/web/Renderer.cfc:586) at coldbox.system.web.renderer_cfc$cf.udfCall(/coldbox/system/web/Renderer.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:205) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:683) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:570) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1937) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:846) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1726) at coldbox.system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:286) at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:215) at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:765) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:768) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1707) at coldbox.system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:472) at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:215) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:682) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:570) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1918) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:768) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1707) at application_cfc$cf.udfCall(/Application.cfc:44) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:215) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:682) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:570) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1918) at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:436) at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:132) at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:42) at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2409) at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2399) at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2374) at lucee.runtime.engine.Request.exe(Request.java:43) at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1037) at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:983) at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97) at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:47) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:64) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:274) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:209) at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:221) at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImplSetup(RequestDispatcherImpl.java:147) at io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:111) at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:45) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:64) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:274) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:209) at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:221) at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImplSetup(RequestDispatcherImpl.java:147) at io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:111) at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:64) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:336) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

That's in the current (5.6) Coldbox release, though IIRC the stack trace was identical in 5.5.

When I started up a fresh Commandbox+Coldbox stock install, it didn't happen; but once I added some modules (both regular CB modules like qb and quick and modules_app modules) then it started happening.

We don't have any valid use cases for wanting to put colons in our URL, but we get malformed URLs, bots, et cetera that will do it, and it hits our general exception handler every time rather than completing the 'page not found' event (which it's obviously got ready to go, from the context of the error).

But this URL:

http://127.0.0.1:56779/foo:bar/Index

Correctly gets us:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 Event: foo:bar.Index Route: :handler/:action/ Route Name: N/A Routed Module: N/A Routed Namespace: N/A Routed URL: foo:bar/Index/ Layout: N/A (Module: ) View: N/A Timestamp: 08/28/2019 07:59:14 AM Type: EventHandlerNotRegisteredException Messages: The event: foo:bar.Index is not a valid registered event. Tag Context: Template: F:\dev\temp\coldbox\system\web\services\HandlerService.cfc LINE: 449: throw( 450: message = "The event: #arguments.event# is not a valid registered event.", 451: type = "EventHandlerNotRegisteredException" 452: ); 453: } Template: F:\dev\temp\coldbox\system\web\services\HandlerService.cfc LINE: 302: 303: // Run invalid event procedures, handler not found as a module or in all lists 304: invalidEvent( arguments.event, oHandlerBean ); 305: 306: // If we get here, then invalid event handler is active and we need to Template: F:\dev\temp\coldbox\system\web\Controller.cfc LINE: 660: // Validate the incoming event and get a handler bean to continue execution 661: results.ehBean = services.handlerService 662: .getHandlerBean( arguments.event ) 663: .setIsPrivate( arguments.private ); 664: Template: F:\dev\temp\coldbox\system\web\Controller.cfc LINE: 566: 567: // Execute our event 568: var results = _runEvent( argumentCollection=arguments ); 569: 570: // Do we have an object coming back? Template: F:\dev\temp\coldbox\system\Bootstrap.cfc LINE: 251: //****** EXECUTE MAIN EVENT *******/ 252: if( NOT event.getIsNoExecution() ){ 253: refResults.results = cbController.runEvent( defaultEvent=true ); 254: } 255: //****** RENDERING PROCEDURES *******/ Template: F:\dev\temp\coldbox\system\Bootstrap.cfc LINE: 470: // Process A ColdBox Request Only 471: if( findNoCase( 'index.cfm', listLast( arguments.targetPage, '/' ) ) ){ 472: processColdBoxRequest(); 473: } 474: return true; Template: F:\dev\temp\Application.cfc LINE: 42: public boolean function onRequestStart( string targetPage ){ 43: // Process ColdBox Request 44: application.cbBootstrap.onRequestStart( arguments.targetPage ); 45: 46: return true;

How or why this is happening is beyond our Coldbox-fu – there should be no difference between these two routes in a stock Coldbox install that doesn't contain a module called either foo or refs or referees. Our Router.cfc is also stock:

1 2 3 4 5 6 7 8 component{ function configure(){ setFullRewrites( true ) .route( ":handler/:action?" ).end(); } }

I thought for the better part of a year that this had to be something in our apps, but the above errors are right out of stock installs. I'm happy to work through this with anybody and if it is something that our code is doing, pay for the time, because this one has been frustrating us for a while!

Status

Assignee

Luis Majano

Reporter

Samuel W. Knowlton

Labels

None

Fix versions

Priority

Major