dougcain
03/11/2025, 11:45 AMprofile:production
blocks CFIDE, if I switch to the server rules I can access CFIDE. Adding "blockCFAdmin":"external"
to server.json when running the server rules also blocks CFIDE as expected.
So it seems that profile:production
doesn't work as expected with the server rules, has anyone else seen this?jclausen
03/11/2025, 1:36 PMfoundeo
blockSensitivePaths: true
which Doug also mentioned to me that he had. According to line 2282 of
ServerService.cfc it looks like it should block the RDS path when profile=production https://github.com/Ortus-Solutions/commandbox/blob/4c528dc8ed17fddf02c6041ab21c6b395157d076/src/cfml/system/services/ServerService.cfc#L2265-L2286foundeo
bdw429s
03/11/2025, 4:41 PMbdw429s
03/11/2025, 4:41 PMbdw429s
03/11/2025, 4:41 PMbdw429s
03/11/2025, 4:41 PMbdw429s
03/11/2025, 4:42 PMbdw429s
03/11/2025, 4:43 PM--trace
flag and watch the debugging in the console when a request comes in to determine what rules fired and what their result was.bdw429s
03/11/2025, 4:45 PMdougcain
03/11/2025, 4:57 PMdougcain
03/11/2025, 5:08 PM2025-03-11 16:59:10 | √ | Setting site [93d692bfd1fa] Profile to [production]
2025-03-11 16:59:10 | |------------------------------------------------------------------
2025-03-11 16:59:10 | | Profile set from profile property in server.json
2025-03-11 16:59:10 | | Block CF Admin enabled
2025-03-11 16:59:10 | | Block Sensitive Paths enabled
2025-03-11 16:59:10 | | Block Flash Remoting enabled
2025-03-11 16:59:10 | | Directory Browsing disabled
2025-03-11 16:59:10 | | File Caching enabled
dougcain
03/11/2025, 5:16 PMbdw429s
03/11/2025, 5:22 PMbdw429s
03/11/2025, 5:22 PMdougcain
03/11/2025, 5:26 PMblock-cf-admin()
to the server rules as profile / blockCFAdmin in server.json were not working (see above). But the secondary part is the regex behind blockCFAdmin
doesn;t include CFIDE/main which triggered the hackmycf RDS alert I asked Pete about.
So server.json rules don't seem to be honoured when using server rules and server rules when blockCFAdmin
is used doesn't stop CFIDE/main (RDS)bdw429s
03/11/2025, 5:28 PMbdw429s
03/11/2025, 5:28 PMbdw429s
03/11/2025, 5:28 PMbdw429s
03/11/2025, 5:28 PMbdw429s
03/11/2025, 5:28 PMbdw429s
03/11/2025, 5:28 PMdougcain
03/11/2025, 5:29 PMbdw429s
03/11/2025, 5:29 PMdougcain
03/11/2025, 5:30 PMbdw429s
03/11/2025, 5:30 PMdougcain
03/11/2025, 5:46 PM# stop processing rules when direct call to cf file
#regex( ".*\.(cfm|cfc)$" ) -> done
#regex-nocase( ".*/index\.cfm" ) -> done
which must run before what ever server.json does so /CFIDE/administrator/index.cfm was allowed by these two and then not run any more rules.bdw429s
03/11/2025, 5:48 PMbdw429s
03/11/2025, 5:48 PMbdw429s
03/11/2025, 5:49 PMbdw429s
03/11/2025, 5:49 PMdone
predicate then NO MORE rules runbdw429s
03/11/2025, 5:49 PMbdw429s
03/11/2025, 5:49 PMbdw429s
03/11/2025, 5:49 PMbdw429s
03/11/2025, 5:49 PMdougcain
03/11/2025, 5:49 PMbdw429s
03/11/2025, 5:50 PMserver set web.rules="['path(/CFIDE/main/ide.cfm)->done']" --append
bdw429s
03/11/2025, 5:50 PMbdw429s
03/11/2025, 5:50 PMbdw429s
03/11/2025, 5:50 PMbdw429s
03/11/2025, 5:50 PMbdw429s
03/11/2025, 5:51 PMdone
in your log files when I had found this
io.undertow.predicate - Regex pattern [.*\.(cfm|cfc)$] MATCHES input [/CFIDE/administrator/index.cfm] for HttpServerExchange{ GET /CFIDE/administrator/index.cfm}.
io.undertow.predicate - Storing regex match group [0] as [/CFIDE/administrator/index.cfm] for HttpServerExchange{ GET /CFIDE/administrator/index.cfm}.
io.undertow.predicate - Storing regex match group [1] as [cfm] for HttpServerExchange{ GET /CFIDE/administrator/index.cfm}.
io.undertow.predicate - Predicate [regex( pattern='.*\.(cfm|cfc)$', value='%{RELATIVE_PATH}', full-match='false', case-sensitive='false' )] resolved to true. Next handler is [done] for HttpServerExchange{ GET /CFIDE/administrator/index.cfm}.
io.undertow.predicate - Predicate chain marked done. Next handler is [Runwar PathHandler] for HttpServerExchange{ GET /CFIDE/administrator/index.cfm}.
and that's when/why I asked to see your custom rulesaliaspooryorik
aliaspooryorik
dougcain
03/11/2025, 5:56 PMdougcain
03/11/2025, 5:56 PMbdw429s
03/11/2025, 5:57 PMpredicate() -> {
handler();
another-handler();
more-here()
}
bdw429s
03/11/2025, 5:58 PMnot regex( ".*\.(cfm|cfc)$" ) {
... non CF rules here
}
aliaspooryorik
aliaspooryorik
aliaspooryorik
not regex( ".*\.(cfm|cfc)$" )
that's exactly what I've just done (need to test it all again) 🙂bdw429s
03/11/2025, 5:59 PMbdw429s
03/11/2025, 5:59 PMbdw429s
03/11/2025, 5:59 PMbdw429s
03/11/2025, 6:00 PMaliaspooryorik
aliaspooryorik
bdw429s
03/11/2025, 6:03 PMelse
keyword to do basic if/then constructsbdw429s
03/11/2025, 6:03 PMaliaspooryorik
bdw429s
03/11/2025, 6:05 PMaliaspooryorik
bdw429s
03/11/2025, 6:07 PMbdw429s
03/11/2025, 6:07 PMaliaspooryorik
bdw429s
03/11/2025, 6:08 PMaliaspooryorik
aliaspooryorik
aliaspooryorik
bdw429s
03/11/2025, 6:10 PMtrue -> anything-here()
is, but it works just as well as the code
if( true ) {
code here...
}
bdw429s
03/11/2025, 6:11 PMbdw429s
03/11/2025, 6:11 PMbdw429s
03/11/2025, 6:14 PMset-error( 404 )
for that because it allows custom error page to workbdw429s
03/11/2025, 6:14 PMaliaspooryorik
410
just giving examples of different response codesaliaspooryorik
set-error
is a commandbox thing only?bdw429s
03/11/2025, 6:39 PMbdw429s
03/11/2025, 6:39 PMaliaspooryorik
bdw429s
03/11/2025, 6:40 PMbdw429s
03/11/2025, 6:40 PMaliaspooryorik
bdw429s
03/11/2025, 6:41 PMbdw429s
03/11/2025, 6:41 PMaliaspooryorik
response-code()
is returning the nice commandbox error page, how does set-error different - is it that it returns a custom page (if you have one defined?)bdw429s
03/11/2025, 6:43 PMbdw429s
03/11/2025, 6:44 PMaliaspooryorik
bdw429s
03/11/2025, 6:44 PMbdw429s
03/11/2025, 6:45 PMaliaspooryorik
/missingfolder/missingfile.cfm
I get the ACF missing template handler. Is there an in-built way to just 404 for any missing cfml file?bdw429s
03/11/2025, 9:42 PMbdw429s
03/11/2025, 9:42 PMaliaspooryorik
path-suffix( { ".cfc", ".cfm" } ) and not is-file and not is-directory -> { set-error( 404 ); done }
but would rather use an in-built rule (or work out why in-built rule isn't kicking in!)bdw429s
03/11/2025, 9:42 PMbdw429s
03/11/2025, 9:43 PMaliaspooryorik
bdw429s
03/11/2025, 9:43 PMbdw429s
03/11/2025, 9:43 PM/CFIDE/administrator/enter.cfm
would always be a 404 from the web serverbdw429s
03/11/2025, 9:44 PMaliaspooryorik
/CFIDE/administrator/index.cfm
with that rule above in playbdw429s
03/11/2025, 9:44 PMbdw429s
03/11/2025, 9:45 PMaliaspooryorik
bdw429s
03/11/2025, 9:46 PMaliaspooryorik
aliaspooryorik
bdw429s
03/11/2025, 9:48 PMbdw429s
03/11/2025, 9:48 PMbdw429s
03/11/2025, 9:49 PMaliaspooryorik
bdw429s
03/11/2025, 9:50 PMaddDefaultResponseListener()
in Undertow, and it does the logic of deciding whether to fire it or notbdw429s
03/11/2025, 9:57 PMif (!exchange.isResponseChannelAvailable()) {
return false;
}
I'm guessing, even if you had an empty missing template handler, the core of Lucee/ACF prolly automatically run a flush through to the servlet to write out the response even if it was empty which means you'd never be able to fire the undertow default response listener.bdw429s
03/11/2025, 9:58 PMaliaspooryorik
bdw429s
03/11/2025, 10:01 PMbdw429s
03/11/2025, 10:01 PMbdw429s
03/11/2025, 10:01 PMaliaspooryorik
aliaspooryorik
curious about the choice of 410updated PR to a 404 🙂