There are a number of key configuration files in Model-Glue that exist as plain XML files. One of the drawbacks to using XML files on a website is that anyone can point their browser at the XML file and read its contents, which is less than ideal from a security standpoint.
There are a number of ways you can make those XML files secure, such as storing them in a directory outside of the web root or configuring your web server to block access to XML files (see Charlie's post for details on those techniques), but not every developer has the permissions needed to implement those solutions.
So one way that you can protect those XML files without needing access to anything beyond the web root is to convert them to .cfm files and prevent them from executing, and here are the exact steps you would use in a typical Model-Glue application to do just that:
- Go to the index.cfm file of your application. Uncomment the
<cfset> line for "CUSTOM APPLICATION CONFIGURATION" and set it to
point to "Coldspring.xml.cfm" instead of "Coldspring.xml".
- Rename "ColdSpring.xml" to "ColdSpring.xml.cfm".
- In
the ColdSpring file, go to the ModelGlue configuration bean definition and
change the "configurationPath" and "scaffoldPath" values to point to
the .cfm equivalent files instead of the original XML ones. If you're using Transfer or Reactor in your application, also update any <constructor-arg> tags in those bean definitions that point to the XML configuration files for those ORM frameworks.
- If you have any other references to .xml files in your ColdSpring file, update those as well.
- In the ModelGlue.xml file in your application, remove
"<cferror>" from the comment above the "page.error" event (if you don't, anyone who does try to browse to that file will generate a ColdFusion error).
- Tack on ".cfm" to the file names of all of the .xml files referred to in steps 3, 4, and 5.
- Add an Application.cfm file to the "config" directory of ModelGlue with one line in it: <cfabort /> That will ensure that the XML is not shown even in the page source if the .xml.cfm file is directly accessed by the browser.
No comments:
Post a Comment