ColdFusion Tips and Tutorials

ColdFusion Tips and Tutorials. Tips on ColdFusion, AJAX, CSS, JavaScript, HTML, Design, and more.

CFUnited Developer Conference 2010
Use this code TIPSCUST to get $100 off your registration @ CFUnited! We'll see you There!


ColdFusion Tips
Page 1 2 3
148 ColdFusion, Ajax, FuseBox, Tips, and Tut
147 Included Point of View
146 Javascript - OnFocus
145 Nathan's Rules of Professional Web Desig
144 Universal Server-Side Check | Bandwidth
143 Meeting Schedule | Identification Sessio
142 Breaking Frames Without Javascript
141 Unreal Forms
140 Screen Resolution
139 Human Help
138 Better Server-Side Validation
137 Automatic Server-Side Validation
136 Regular Expression Laboratory,ColdFusion
135 Rank-Ordered Site Search
134 Building Cryptograms
133 Well-Formed Includes
132 Grouping Families for Visits
131 Display Families on a Map Grid
130 Slide Shows
129 Determine Your Database Engine
128 ColdFusion in Context: Maxlength Lies
127 Something Extra
126 Parsing Database Structure from Data Def
125 Valid Values Maintenance
124 Print 1
123 Hide Session Id
122 Downsizing Data to Access
121 Time to Load a Page, FuseBox 4
120 Order and Rank by Subset
119 Warn through E-mail & Update on Paste Sp
118 Paste Spreadsheets, ColdFusion Component
117 Review Files Having Fixed-Length Fields
116 Organized Help
115 Sequence Slider
114 Bad Bits
113 Logical Deduction
112 Whiteout
111 Forced Navigation
110 Managing Permissions
109 Time Travel
108 Test First
107 Get Distance Between Map Coordinates
106 Validating Checkboxes
105 Matrix Manipulation
104 Field Help
103 Fake Object Not Found
102 Rank Order Correlation Coefficient
101 From Calling Pairs to Calling Tree
100 Posting Notice
99 Logout Persuasion
98 Release Session Memory
97 Use Identically Named Fields
96 Web Bug
95 Password Generation
94 Core Queries
93 Use CFFTP
92 Insert, Update, and Delete
91 Stack
90 T-Value
89 Bulk Data Entry and E-mail Validation
88 Quick Reset
87 Design 1
86 Use CFFTP
85 Support Login with AutoPost
84 Login and Site Protection
83 XY Graphs in a Graphing Calculator
82 Read Encrypted Files
81 Showing Progress
80 Frugal Cross-Browser Javascript
79 Tabbed Folders
Page 1 2 3



Custom Search
ColdFusion TIPS PLUS


Issue 00111 http://www.cftipsplus.com

I. My Comments

II. ColdFusion In Context: Forced Navigation
By R. Martin Ladner
martin.ladner@charter.net



See our sponsors at the bottom of this e-mail.

I. Comments:

If you would like to help with this ezine please send me a email at
NathanS<at>nsnd.com


Keep Coding,
Nathan Stanford
http://www.cftipsplus.com

Donations to keep cftips alive at:
https://www.paypal.com/xclick/business=admin%40nsnd.com&item_name=CFTipsPlus

If you have suggestions for articles send them to us.
If you would like to write for cftipsplus.com
send us an email to:

NathanS<at>nsnd.com

IF YOU WANT TO BE AN AUTHOR SEND IN YOUR COLDFUSION TIPS.

Remember this is a great way to get your name known in the
ColdFusion Community.



II. ColdFusion in Context: Forced Navigation
By R. Martin Ladner
martin.ladner@charter.net



Suppose you have locked down various functions performed by your site so that people can't use them without appropropriate permission but now your customer wants to force users to navigate using menus provided instead of letting them hop between functions directly.
First of all, I think this is a bad idea; because, it fosters the illusion that you don't have to protect the individual functions - you DO have to protect them. Methods of forcing users to navigate in a particular fashion are not foolproof. Nevertheless, the customer ... is the customer. So, how do you give this request the attention it deserves?

Seek Referrals
Whenever someone simply pastes a URL into the browser window, the browser reports that the previous (referring) URL is empty. One straightforward universal approach to enforcing the use of menus, therefore, is to disallow the use of a page if the referring URL is empty.
It's based on the premise that when a browser moves from one page to the next through a link or through the action attribute of a form, the URL of the page the browser just left is available as HTTP_REFERER. (Yes, I know referrer is spelled wrong, but blame it on the folks who created the standard and use their spelling. It's not ColdFusion's fault, either.)

Create a "work1" directory just below the root and put this code in Application.cfm within it. Once you've done this, anyone simply pasting a URL into the browser will eventually be diverted to the menu.


<cfif not len(trim(cgi.http_referer))>
You have strayed. "Return" will bring you back to the menu.
<form action="../menu.cfm"><input type="submit" value="Return"></form>
<cfabort>
</cfif>

Suppose, however, that I have my own Web site and I'm tired of your lousy navigation scheme. If I create a page on my own site that links to where I want to go, http_referer will have a value: MY domain name and directory down to the page I came from. Knowing this also helps you plan a defense that can still be generic but a bit stronger. Create a "work2" directory just below the root and put this code in Application.cfm there.


<cfif cgi.http_referer does not contain cgi.server_name>
You have strayed. "Return" will bring you back to the menu.
<form action="../menu.cfm"><input type="submit" value="Return"></form>
<cfabort>
</cfif>

Build a very simple menu, menu.cfm, at the root.


<a href="work1/function1.cfm">Function 1</a>
<p>
<a href="work2/function2.cfm">Function 2</a>

Build function1.cfm in work and function2.cfm in work and work2 respectively. Have them say "You have reached the page for function 1" and "You have reached the page for function 2" respectively.

Distrust Referrals
Try function 1. Copy the URL. Go somewhere else, paste the URL into the browser, and watch it bounce you back to the menu. Not bad. It's not necessary to see if the previous page is the one you wanted to come from; because, any attempt to paste in a page will bounce the user. So, the user used the menu...probably.
Now from some other site - maybe you have a cheap site that doesn't have ColdFusion - make a page and link to function 1. This time, you'll reach function 1 without going through the menu. The protecting code only checks to be sure you didn't paste in a URL; it doesn't care what it is.

Try to reach function 2 from some other site. Make a page link from there to function 2. Notice that this time you're blocked; because, the refering page isn't in the same domain as the target link, and the code does care.

Finally, you could also be attacked from text fields on your own Web site - similar things have been done in an attempt to use your own domain name against you. In the final analysis, checking the referring page will keep all but the most determined people away from your resources, but determined people are the ones you bring out the big guns for.

Block Browsing by Targeting Includes
Create a "work3" directory just below the root and put this code in Application.cfm within it. Once you've done this, anyone trying to browse any page in the directory will be noiselessly diverted to the menu.

<cflocation url="../menu.cfm">
<cfabort>

Build function3.cfm in work3. Have it say: "You have reached the page for function 3".

Try to browse that page from anywhere; you can't, not even with a link or as a form action. So what good is it? You can INCLUDE it whenever appropriate. However, browsing it will cause Application.cfm to be included first, causing the diversion.

Postlude
Referrals will keep all but the toughest users honest. Includes provide iron-clad protection for pages you don't have to browse. However, if you want to sleep well at night, set permissions in session memory and read a copy of them prior to performing any important function.

=Marty=



SPONSOR ADS:
This e-mail is sponsored by the following ads.


Books For Sale
http://nsnd.vstorelibrary.com/



Advanced, Intensive ColdFusion Training!
Visit this site. If you have plans to get training here is a company
that provides Advanced, Intensive ColdFusion Training. Check them out.
http://www.coldfusiontraining.com/index.cfm?ref=cftipsplus



Publisher and Creator:
Nathan Stanford,
NathanS<at>nsnd.com
http://www.cftipsplus.com

Macromedia and ColdFusion are U.S. registered trademarks.


Copyright (c) 2000 - 2002
CFTIPSPLUS.COM and NSND.COM

Permission is granted to circulate this publication via
MANUAL forwarding by email to friends provided that the text is
forwarded in its entirety and no fee is charged.

Photo of Nathan Stanford
Nathan Stanford
LinkedIn

R. Marty Ladner's
Site