|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
SitePoint Articles
Join Date: Apr 2001
Posts: 0
|
Discussion thread for Paranoia: Cross Site Scripting
This is a dedicated thread for discussing the SitePoint article 'Paranoia: Cross Site Scripting'
|
|
|
|
|
|
#2 |
|
Test cases complete. 0 fails.
![]() Join Date: Feb 2001
Location: Melbourne Australia
Posts: 6,721
|
An informative article. I see it as a rather long-winded way of saying "always validate your input".
Cross site scripting is a relatively harmless side-effect of not validating your input. Other side effects can be much worse. I'm referring to situations where you are using an input variable as part of a database query, or you are evaluating a string. In my scripts (I use PHP), I use a function I created called load_var() to fetch variables from input variables, and validate them at the same time. For example, load_var('name', 'REQUEST', 'title') loads the variable 'name' from the request fields, and validates it against a pattern I have called 'title'. The 'title' pattern includes all letters, digits, spaces, and a few punctuation marks. If the variable contains any other digits, my function returns false. I have patterns for int, yesno, float, and so on. One pattern is called string, and it can include any data at all. I think it's good practice to create a function like this. If you change your pattern matching requirements, for example, if you want to start allowing underscores in names, you only have to modify the validation code in one place. |
|
|
|
|
|
#3 |
|
.NET inside
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2002
Location: Strongsville OH
Posts: 1,588
|
if you are using asp.net properly (like not using Response.Write) you do not have to worry about this as much.
asp.net helps safeguard against this. one example can be seen in this thread http://www.sitepointforums.com/showt...hreadid=125914 |
|
|
|
|
|
#4 | |
|
SitePoint Enthusiast
![]() Join Date: Nov 2003
Location: US
Posts: 33
|
Quote:
Also if you stick to using stored procedures and passing data via parameters, and execute permissions are only given to the sprocs, then potential for cross scripting is reduced. This article on MSDN is pretty good. Framework 1.0 doesn't have ValidateRequest=true (it was introduced in 1.1) but you can implement it yourself if need be: http://msdn.microsoft.com/asp.net/de...protection.asp Last edited by cejua; Dec 22, 2003 at 04:45. |
|
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 03:25.










Hybrid Mode
