Comment On Poor Mr. O'Hare

The Representative Line is one of my favorite ways of presenting a titanic (an adjective chosen for more than its synonymity with "frickin' huge") application. Today's single line of code comes from a large web-based application that John F has come to maintain. Like other Representative Lines, the more you look and analyze it, the more you know about the system and the pain that John and his colleagues go through each day. This line was discovered (actually 23 instances of it) while trying to fix a bug reported by a new user of the system ... [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7 | Page 8Next »

Re: Poor Mr. O'Hare

2006-08-22 14:17 • by Alex Papadimoulis

When developing an application that uses in-line SQL queries, it's essential to protect against "SQL Injection", i.e. the insertion of SQL code as a result of a string concatenation. For example, if productNum comes directly from user input, it might contain a malicious string, such as "'; DROP DATABASE --"


myQuery = "SELECT Prod_Name FROM Products WHERE Prod_Num='" + productNum "';";

The best way to do this is through "parameterized queries," which lets the database libraries take care of it. The next best way is to write your own escaping functions. And the next best way is to replace all instances of "O'Reily" with "O''Reily".

Re: Poor Mr. O'Hare

2006-08-22 14:20 • by Anonymous
INJECTION IS NOT YOUR FRIEND!

Re: Poor Mr. O'Hare

2006-08-22 14:22 • by joe bruin
87230 in reply to 87227
What if my login name is Mister '; DROP DATABASE;

(okay, that exact form wouldn't work, but you get the idea)

Re: Poor Mr. O'Hare

2006-08-22 14:22 • by JR
Simple, ban the Irish and the Scots.

Re: Poor Mr. O'Hare

2006-08-22 14:23 • by Satanicpuppy
Stupid. Where there is one special case there are a million, so, unless you want to fix them all by hand, it's time to re-imagine your logic.

I had the reverse problem once...I was working on a system where the system automatically threw out all SSNs that started with  "800". I got egg on my face because I told the user that that was impossible (I hadn't written the application, and I "knew" the guy who had hadn't been a MORON), and when she
showed me that it was possible, I set forth on an quest to find the one line of code that declared all 800 ssns invalid.

Sigh.

Re: Poor Mr. O'Hare

2006-08-22 14:25 • by Christophe

Am I to understand that each O'+(A-Za-z) surname needs to have its own set of 23 occurrences of that line of code?


NOOOOoooooooo!!!!!

Re: Poor Mr. O'Hare

2006-08-22 14:25 • by Russ
87235 in reply to 87227
Alex Papadimoulis:

When developing an application that uses in-line SQL queries, it's essential to protect against "SQL Injection", i.e. the insertion of SQL code as a result of a string concatenation. For example, if productNum comes directly from user input, it might contain a malicious string, such as "'; DROP DATABASE --"


myQuery = "SELECT Prod_Name FROM Products WHERE Prod_Num='" + productNum "';";

The best way to do this is through "parameterized queries," which lets the database libraries take care of it. The next best way is to write your own escaping functions. And the next best way is to replace all instances of "O'Reily" with "O''Reily".



Actually the best way of doing it is to use a real web programming language like ColdFusion, which will do all the escaping for you.  The best, best way is to do it in coldfusion with parametarized queries, but even if the coder is not smart enough to use them, this kind of issue just wouldn't even come up.    

Re: Poor Mr. O'Hare

2006-08-22 14:26 • by GoatCheez
These latest WTFs have been.... what's the word..... expected. Things like this happen all too often. I kind of wonder why MORE websites aren't hacked, as things like this are just so common.

I'm hoping the recent lack of code WTFs aren't from a previous comment I made... It was in jest... well, sorta ;-P



The TRUE wtf is that they didn't put all of the exceptions into a function named IrishLastNameConverter lol ;-P

Re: Poor Mr. O'Hare

2006-08-22 14:26 • by Colin
87237 in reply to 87229
Anonymous:
INJECTION IS NOT YOUR FRIEND!


Only when going through substance abuse rehabilitation!

Re: Poor Mr. O'Hare

2006-08-22 14:29 • by DZ-Jay
87238 in reply to 87235
Anonymous:

Actually the best way of doing it is to use a real web programming language like ColdFusion, which will do all the escaping for you.  The best, best way is to do it in coldfusion with parametarized queries, but even if the coder is not smart enough to use them, this kind of issue just wouldn't even come up.    


ColdFusion, a Real web programming language? Hahahahahahahaahahahahahahahahahahahahaha!!!!

Thanks for that! :)
    dZ.

Re: Poor Mr. O'Hare

2006-08-22 14:31 • by Russ
87239 in reply to 87238
DZ-Jay:
Anonymous:

Actually the best way of doing it is to use a real web programming language like ColdFusion, which will do all the escaping for you.  The best, best way is to do it in coldfusion with parametarized queries, but even if the coder is not smart enough to use them, this kind of issue just wouldn't even come up.    


ColdFusion, a Real web programming language? Hahahahahahahaahahahahahahahahahahahahaha!!!!

Thanks for that! :)
    dZ.


About 10 times better then ASP or PHP.  Maybe ASP.NET or JSP can compete with it, but nothing can beat the RAD functionality of ColdFusion.

Re: Poor Mr. O'Hare

2006-08-22 14:31 • by merreborn
87240 in reply to 87232
Satanicpuppy:
Stupid. Where there is one special case there are a million, so, unless you want to fix them all by hand, it's time to re-imagine your logic.

I had the reverse problem once...I was working on a system where the system automatically threw out all SSNs that started with  "800". I got egg on my face because I told the user that that was impossible (I hadn't written the application, and I "knew" the guy who had hadn't been a MORON), and when she
showed me that it was possible, I set forth on an quest to find the one line of code that declared all 800 ssns invalid.

Sigh.


"Currently, a valid SSN cannot have the first three digits (the area
number) above 772, the highest area number which the Social Security
Administration has allocated."

http://en.wikipedia.org/wiki/Social_Security_number_%28United_States%29#Valid_SSNs

Either wikipedia's dead wrong, or someone was feeding your system invalid SSNs

Re: Poor Mr. O'Hare

2006-08-22 14:34 • by R.Flowers
Apparently the developer had never heard of the popular line of IT books, the "O'Hare Library."

Re: Poor Mr. O'Hare

2006-08-22 14:35 • by Digitalbath
87242 in reply to 87238

DZ-Jay:
Anonymous:

Actually the best way of doing it is to use a real web programming language like ColdFusion, which will do all the escaping for you.  The best, best way is to do it in coldfusion with parametarized queries, but even if the coder is not smart enough to use them, this kind of issue just wouldn't even come up.    


ColdFusion, a Real web programming language? Hahahahahahahaahahahahahahahahahahahahaha!!!!

Thanks for that! :)
    dZ.


I used ColdFusion a little bit at my last job.  It made me want to CFPuke.  Zing!

Re: Poor Mr. O'Hare

2006-08-22 14:35 • by DZ-Jay
87243 in reply to 87239
Anonymous:
DZ-Jay:
Anonymous:

Actually the best way of doing it is to use a real web programming language like ColdFusion, which will do all the escaping for you.  The best, best way is to do it in coldfusion with parametarized queries, but even if the coder is not smart enough to use them, this kind of issue just wouldn't even come up.    


ColdFusion, a Real web programming language? Hahahahahahahaahahahahahahahahahahahahaha!!!!

Thanks for that! :)
    dZ.


About 10 times better then ASP or PHP.  Maybe ASP.NET or JSP can compete with it, but nothing can beat the RAD functionality of ColdFusion.


There are certainly other frameworks for developing web applications apart from ASP or PHP, and some of them focus on RAD, some of them even better, faster, and more robust and secure than your precious ColdFusion.  But I most definitely wouldn't call ColdFusion a "Real Programming Language".

    -dZ.

Re: Poor Mr. O'Hare

2006-08-22 14:37 • by padren
87244 in reply to 87235
Anonymous:

Actually the best way of doing it is to use
a real web programming language like ColdFusion, which will do all the
escaping for you.  The best, best way is to do it in coldfusion
with parametarized queries, but even if the coder is not smart enough
to use them, this kind of issue just wouldn't even come up. 
  




Though, chances are if you do have a coder that is not smart enough to
conceptualize that building any dynamic data into any instruction set
(SQL, JS, etc) will require escaping to seperate dynamic data from
characters used by the language.... its better to know than suppress
the error condition (yes, there is no error in the code, but there
would be one in management).



JS:

alert("Wouldn't he "miss" this too?");



...and I bet the text field in a webform would probably read "O"
instead of "O'Hare" and in the source you'd see <input type='text'
name='user' value='O'Hare'>

Re: Poor Mr. O'Hare

2006-08-22 14:39 • by Russ
87246 in reply to 87244
Anonymous:
Anonymous:

Actually the best way of doing it is to use
a real web programming language like ColdFusion, which will do all the
escaping for you.  The best, best way is to do it in coldfusion
with parametarized queries, but even if the coder is not smart enough
to use them, this kind of issue just wouldn't even come up. 
  




Though, chances are if you do have a coder that is not smart enough to
conceptualize that building any dynamic data into any instruction set
(SQL, JS, etc) will require escaping to seperate dynamic data from
characters used by the language.... its better to know than suppress
the error condition (yes, there is no error in the code, but there
would be one in management).



JS:

alert("Wouldn't he "miss" this too?");



...and I bet the text field in a webform would probably read "O"
instead of "O'Hare" and in the source you'd see <input type='text'
name='user' value='O'Hare'>


It doesn't get suppressed, coldfusion just escapes it automatically when you use it in a query.  As far as input's there are functions to escape that as well, but it's not done automatically. 

Re: Poor Mr. O'Hare

2006-08-22 14:40 • by merreborn
87247 in reply to 87235
Anonymous:

Actually the best way of doing it is to use a real web programming language like ColdFusion, which will do all the escaping for you.


Ew.  PHP optionally does that, it's called "magic_quotes_gpc", and any application that relies on it is considered crap.  Run escaping functions in appropriate places, or use parameterized queries.  Don't rely on the language to escape every piece of input for you, and then run a stripslashes()-esque function on the data that shouldn't be escaped.  That's just disgusting.  Although I guess we should expect terrible advice like this from a coldfusion "developer".

Re: Poor Mr. O'Hare

2006-08-22 14:41 • by Russ
87248 in reply to 87243
DZ-Jay:

There are certainly other frameworks for developing web applications apart from ASP or PHP, and some of them focus on RAD, some of them even better, faster, and more robust and secure than your precious ColdFusion.  But I most definitely wouldn't call ColdFusion a "Real Programming Language".

    -dZ.



Name one. 

And I didn't say it's a real programming language.  I said it's a "Real Web Programming Language".  It has not much use outside the web world, but in the web world it's one of the most robust, RAD platforms out there.  Seriously.  I dare you.  Name one other programming language that even comes close to CF in terms of RAD. 

Re: Poor Mr. O'Hare

2006-08-22 14:42 • by richleick
87249 in reply to 87227
Alex Papadimoulis:

When developing an application that uses in-line SQL queries, it's essential to protect against "SQL Injection", i.e. the insertion of SQL code as a result of a string concatenation. For example, if productNum comes directly from user input, it might contain a malicious string, such as "'; DROP DATABASE --"


myQuery = "SELECT Prod_Name FROM Products WHERE Prod_Num='" + productNum "';";

The best way to do this is through "parameterized queries," which lets the database libraries take care of it. The next best way is to write your own escaping functions. And the next best way is to replace all instances of "O'Reily" with "O''Reily".

Close.  Add the use of stored procedures and I'm all for it.  Oh wait, that would mean if you are using an earlier version of MySQL you probably never heard of these.

Re: Poor Mr. O'Hare

2006-08-22 14:42 • by jim
87250 in reply to 87235
No, don't let ColdFusion escape it, use parameters.  Without parameters you are creating a security hole large enough to drive a truck through.  Do it right.  Also parameters are supported by most major database vendors and is more performant.

Re: Poor Mr. O'Hare

2006-08-22 14:43 • by Russ
87251 in reply to 87247
merreborn:
Anonymous:

Actually the best way of doing it is to use a real web programming language like ColdFusion, which will do all the escaping for you.


Ew.  PHP optionally does that, it's called "magic_quotes_gpc", and any application that relies on it is considered crap.  Run escaping functions in appropriate places, or use parameterized queries.  Don't rely on the language to escape every piece of input for you, and then run a stripslashes()-esque function on the data that shouldn't be escaped.  That's just disgusting.  Although I guess we should expect terrible advice like this from a coldfusion "developer".


Magic quotes is totally different.  ColdFusion only does automatic escaping inside queries, not on all your data.  Therefore there are no problems with having to un-escape things.  So you've proved my point, CF is better then PHP.

Re: Poor Mr. O'Hare

2006-08-22 14:44 • by dasgsdgsd
87253 in reply to 87246
Ah, another useless CF coder.

 

CF does *not* automatically prevent of SQL injection.

 

Doing this in CF is just as bad as the example quoted:

 

<cfquery>

select *

from table

where id = #id#

</cfquery>

 

The way to prevent SQL injection in CF is to use the <cfqueryparam> tag.

 


<cfquery>

select *

from table

where id = <cfqueryparam value="#id#">

</cfquery>

 

Gawd, why the hell are all CF users so damned smug and yet so dumb?

Re: Poor Mr. O'Hare

2006-08-22 14:44 • by themagni
87254 in reply to 87240
merreborn:
Satanicpuppy:
Stupid. Where there is one special case there are a million, so, unless you want to fix them all by hand, it's time to re-imagine your logic.

I had the reverse problem once...I was working on a system where the system automatically threw out all SSNs that started with  "800". I got egg on my face because I told the user that that was impossible (I hadn't written the application, and I "knew" the guy who had hadn't been a MORON), and when she
showed me that it was possible, I set forth on an quest to find the one line of code that declared all 800 ssns invalid.

Sigh.


"Currently, a valid SSN cannot have the first three digits (the area
number) above 772, the highest area number which the Social Security
Administration has allocated."

http://en.wikipedia.org/wiki/Social_Security_number_%28United_States%29#Valid_SSNs

Either wikipedia's dead wrong, or someone was feeding your system invalid SSNs


They're using the 800 series for Illegal Immigrants.

Re: Poor Mr. O'Hare

2006-08-22 14:44 • by Russ
87255 in reply to 87249
richleick:
Alex Papadimoulis:

When developing an application that uses in-line SQL queries, it's essential to protect against "SQL Injection", i.e. the insertion of SQL code as a result of a string concatenation. For example, if productNum comes directly from user input, it might contain a malicious string, such as "'; DROP DATABASE --"


myQuery = "SELECT Prod_Name FROM Products WHERE Prod_Num='" + productNum "';";

The best way to do this is through "parameterized queries," which lets the database libraries take care of it. The next best way is to write your own escaping functions. And the next best way is to replace all instances of "O'Reily" with "O''Reily".

Close.  Add the use of stored procedures and I'm all for it.  Oh wait, that would mean if you are using an earlier version of MySQL you probably never heard of these.


I have sort of a problem with stored procedures.  You can't keep them in subversion.  At least it's not easy.  With coldfusion, you can create parametized queries, which come very close to stored procedures, and can be stored in an svn repository. 

Re: Poor Mr. O'Hare

2006-08-22 14:46 • by Dave
87256 in reply to 87248
Anonymous:
DZ-Jay:

There are certainly other frameworks for developing web applications apart from ASP or PHP, and some of them focus on RAD, some of them even better, faster, and more robust and secure than your precious ColdFusion.  But I most definitely wouldn't call ColdFusion a "Real Programming Language".

    -dZ.



Name one. 
 


Ruby.

Re: Poor Mr. O'Hare

2006-08-22 14:47 • by Jud
can you guys PLEASE find something more interesting to talk about than development platform wars.. it's so tired!

Re: Poor Mr. O'Hare

2006-08-22 14:47 • by Russ
87258 in reply to 87253
Anonymous:
Ah, another useless CF coder.

 

CF does *not* automatically prevent of SQL injection.

 

Doing this in CF is just as bad as the example quoted:

 

<cfquery>

select *

from table

where id = #id#

</cfquery>

 

The way to prevent SQL injection in CF is to use the <cfqueryparam> tag.

 


<cfquery>

select *

from table

where id = <cfqueryparam value="#id#">

</cfquery>

 

Gawd, why the hell are all CF users so damned smug and yet so dumb?


I never said that it automatically prevents SQL injection, but it does automatically escape single quotes. 

Although your example is one of the right ways to prevent sql injection, there are many more. 

<cfargument name="id" type="numeric">

and
<cfquery>

select *

from table

where id = #val(id)#

</cfquery>

 
are 2 other ways, and neither of them prevents you from caching the query. 

So stop shooting off your mouth when you don't know any better.   

Re: Poor Mr. O'Hare

2006-08-22 14:51 • by Russ
87259 in reply to 87256
Anonymous:
Anonymous:
DZ-Jay:

There are certainly other frameworks for developing web applications apart from ASP or PHP, and some of them focus on RAD, some of them even better, faster, and more robust and secure than your precious ColdFusion.  But I most definitely wouldn't call ColdFusion a "Real Programming Language".

    -dZ.



Name one. 
 


Ruby.


Personally, I haven't looked into Ruby yet, and although I've heard good things, I have doubts on whether it has half the functionality offered by ColdFusion.  So even If I concede this point, there are not a lot of platforms out there that can outperform ColdFusion, especially since it's a J2EE platform now.  If I have a problem with the performance, I can always throw together a java class that does what I need, and call it nativelly from coldfusion. 

Re: Poor Mr. O'Hare

2006-08-22 14:51 • by GoatCheez
87260 in reply to 87257
Anonymous:
can you guys PLEASE find something more interesting to talk about than development platform wars.. it's so tired!


No, YOU'RE A TOWEL!!!

Re: Poor Mr. O'Hare

2006-08-22 14:51 • by Philbert Desanex
87261 in reply to 87255

I have sort of a problem with stored procedures.  You can't keep them in subversion.  At least it's not easy.  With coldfusion, you can create parametized queries, which come very close to stored procedures, and can be stored in an svn repository. 


This has to be the most specious reason I've ever heard for not using stored procedures.  Granted, it's clunky to properly version them in any source code repository, but the benefits of using them (beyond just avoiding injection attacks) far outweigh this minor inconvenience.

Re: Poor Mr. O'Hare

2006-08-22 14:53 • by mhughes
87262 in reply to 87248
Anonymous:


Name one. 

And I didn't say it's a real programming language.  I said it's a "Real Web Programming Language".  It has not much use outside the web world, but in the web world it's one of the most robust, RAD platforms out there.  Seriously.  I dare you.  Name one other programming language that even comes close to CF in terms of RAD. 


I haven't used CF in a long time... is the following still true?

Cold Fusion is to (Ruby On Rails | PHP | JSP) what Visual Basic is to (C++ | C# | Java)

Re: Poor Mr. O'Hare

2006-08-22 14:53 • by Russ
87263 in reply to 87261
Anonymous:

I have sort of a problem with stored procedures.  You can't keep them in subversion.  At least it's not easy.  With coldfusion, you can create parametized queries, which come very close to stored procedures, and can be stored in an svn repository. 


This has to be the most specious reason I've ever heard for not using stored procedures.  Granted, it's clunky to properly version them in any source code repository, but the benefits of using them (beyond just avoiding injection attacks) far outweigh this minor inconvenience.



Such as?  I can write any stored procedure inside a CF query, and it will probably run in about the same time if I use parameters to call it.  Other then speed, what other benefits are there?

Re: Poor Mr. O'Hare

2006-08-22 14:57 • by Russ
87264 in reply to 87262
mhughes:
Anonymous:


Name one. 

And I didn't say it's a real programming language.  I said it's a "Real Web Programming Language".  It has not much use outside the web world, but in the web world it's one of the most robust, RAD platforms out there.  Seriously.  I dare you.  Name one other programming language that even comes close to CF in terms of RAD. 


I haven't used CF in a long time... is the following still true?

Cold Fusion is to (Ruby On Rails | PHP | JSP) what Visual Basic is to (C++ | C# | Java)


First of all, it's ColdFusion, the space from the name was dropped about 10 years ago.

CF has a plethora of frameworks available to it (such as Rails for Ruby), CF on Wheels intends to be a direct competitor to Ruby on Rails. 

PHP is not even in the same category as it's a piece of crap. 

JSP I believe is more efficient then coldfusion, but a lot harder to code in.  Basically you are trading execution speed for development time.  And with the speed of the servers on the market today, do you really want to do that?

ColdFusion runs on top of J2EE sort of like JSP.  It also allows you to call java classes nativelly.  So basically it's JSP that's a little slower, but lets you develop applications a lot faster.

   

Re: Poor Mr. O'Hare

2006-08-22 14:59 • by richleick
87265 in reply to 87263
Anonymous:
Anonymous:

I have sort of a problem with stored procedures.  You can't keep them in subversion.  At least it's not easy.  With coldfusion, you can create parametized queries, which come very close to stored procedures, and can be stored in an svn repository. 


This has to be the most specious reason I've ever heard for not using stored procedures.  Granted, it's clunky to properly version them in any source code repository, but the benefits of using them (beyond just avoiding injection attacks) far outweigh this minor inconvenience.



Such as?  I can write any stored procedure inside a CF query, and it will probably run in about the same time if I use parameters to call it.  Other then speed, what other benefits are there?
Seriously?  For one, stored procedures are more secure.  By assigning permissions you can determine what users/groups can execute them.  The get compiled and optimized by the database.  I honestly can't believe this is even a question.  I don't mean to sound snobby or arrogant, but come on.
.

Re: Poor Mr. O'Hare

2006-08-22 14:59 • by Jud
87266 in reply to 87261
Anonymous:

I have sort of a problem with stored procedures.  You can't keep them in subversion.  At least it's not easy.  With coldfusion, you can create parametized queries, which come very close to stored procedures, and can be stored in an svn repository. 


This has to be the most specious reason I've ever heard for not using stored procedures.  Granted, it's clunky to properly version them in any source code repository, but the benefits of using them (beyond just avoiding injection attacks) far outweigh this minor inconvenience.



I used to think it was not practical to version stored procedures when I worked for a bunch of cowboys.  After switching to a company that has change management (the only way to deploy code is through the source repository) it's not that much of a hassle, and it's nice to always know what version is in each environment.


Some management tools, SSMS for example, have integrated source control.  Even without such a tool the benefits far outweigh the minor inconvenience of checking out a script file.

Re: Poor Mr. O'Hare

2006-08-22 15:00 • by JR
87267 in reply to 87235

Anonymous:


Actually the best way of doing it is to use a real web programming language like ColdFusion, which will do all the escaping for you.  The best, best way is to do it in coldfusion with parametarized queries, but even if the coder is not smart enough to use them, this kind of issue just wouldn't even come up.    


Troll.  Set IGNORE ON

Re: Poor Mr. O'Hare

2006-08-22 15:01 • by Skeeter S. Deskeet
87268 in reply to 87259
Anonymous:
Anonymous:
Anonymous:
DZ-Jay:

There are certainly other frameworks for developing web applications apart from ASP or PHP, and some of them focus on RAD, some of them even better, faster, and more robust and secure than your precious ColdFusion.  But I most definitely wouldn't call ColdFusion a "Real Programming Language".

    -dZ.



Name one. 
 


Ruby.



Personally, I haven't looked into Ruby yet, and although I've heard good things, I have doubts on whether it has half the functionality offered by ColdFusion.  So even If I concede this point, there are not a lot of platforms out there that can outperform ColdFusion, especially since it's a J2EE platform now.  If I have a problem with the performance, I can always throw together a java class that does what I need, and call it nativelly from coldfusion. 



Do not question the Dave!

Re: Poor Mr. O'Hare

2006-08-22 15:01 • by richleick
87269 in reply to 87263
Anonymous:
Anonymous:

I have sort of a problem with stored procedures.  You can't keep them in subversion.  At least it's not easy.  With coldfusion, you can create parametized queries, which come very close to stored procedures, and can be stored in an svn repository. 


This has to be the most specious reason I've ever heard for not using stored procedures.  Granted, it's clunky to properly version them in any source code repository, but the benefits of using them (beyond just avoiding injection attacks) far outweigh this minor inconvenience.



Such as?  I can write any stored procedure inside a CF query, and it will probably run in about the same time if I use parameters to call it.  Other then speed, what other benefits are there?
Straight from the Cold Fusion people:
http://www.adobe.com/devnet/coldfusion/articles/beg_storedproc_02.html

MAN!

Re: Poor Mr. O'Hare

2006-08-22 15:02 • by Jan
Wow, they were lucky that it wasn't Mr O'Drop Table who applied there.

Note: I know that this won't work in a query, but imagine it does.

Re: Poor Mr. O'Hare

2006-08-22 15:05 • by FrostCat
87271 in reply to 87240

Wikipedia's page on SSNs is incomplete.  It doesn't mention railroad SSNs, nowhere near the entire set of which were ever allocated (and the set has been retired so there will be no more of them.)  There are also holes, IIRC, because not all the prefixes have been assigned.

Re: Poor Mr. O'Hare

2006-08-22 15:09 • by Saarus
87273 in reply to 87254
themagni:
merreborn:
Satanicpuppy:
Stupid. Where there is one special case there are a million, so, unless you want to fix them all by hand, it's time to re-imagine your logic.

I had the reverse problem once...I was working on a system where the system automatically threw out all SSNs that started with  "800". I got egg on my face because I told the user that that was impossible (I hadn't written the application, and I "knew" the guy who had hadn't been a MORON), and when she
showed me that it was possible, I set forth on an quest to find the one line of code that declared all 800 ssns invalid.

Sigh.


"Currently, a valid SSN cannot have the first three digits (the area
number) above 772, the highest area number which the Social Security
Administration has allocated."

http://en.wikipedia.org/wiki/Social_Security_number_%28United_States%29#Valid_SSNs

Either wikipedia's dead wrong, or someone was feeding your system invalid SSNs


They're using the 800 series for Illegal Immigrants.


The use of 800-series SSNs is not restricted to illegal immigrants.

When I was in the USAF I worked medical records, which are filed by SSN. On base would be foreign military members and family members, on exchange for training or layover, who had no SSNs. SSN is required for medical treatment in a military medical facility. For all such foreign nationals, they are assigned a SSN which starts with 800. the rest is determined by DOB. If two or more such people have the same DOB, the first three digits are incremented.

Re: Poor Mr. O'Hare

2006-08-22 15:12 • by Bus Raker
87274 in reply to 87249
richleick:
Alex Papadimoulis:

When developing an application that uses in-line SQL queries, it's essential to protect against "SQL Injection", i.e. the insertion of SQL code as a result of a string concatenation. For example, if productNum comes directly from user input, it might contain a malicious string, such as "'; DROP DATABASE --"



myQuery = "SELECT Prod_Name FROM Products WHERE Prod_Num='" + productNum "';";

The best way to do this is through "parameterized queries," which lets the database libraries take care of it. The next best way is to write your own escaping functions. And the next best way is to replace all instances of "O'Reily" with "O''Reily".


Close.  Add the use of stored procedures and I'm all for it.  Oh wait, that would mean if you are using an earlier version of MySQL you probably never heard of these.


Uh ... I think parameterized queries = stored procedures.  Is there another kind I don't know about?

Re: Poor Mr. O'Hare

2006-08-22 15:13 • by John Bigboote
87275 in reply to 87255
Anonymous:

I have sort of a problem with stored procedures.  You can't keep them in subversion.  At least it's not easy.  With coldfusion, you can create parametized queries, which come very close to stored procedures, and can be stored in an svn repository. 


And, as we all know, design decisions are best made in terms of what's most convenient for the developer.

Re: Poor Mr. O'Hare

2006-08-22 15:13 • by Sean
87276 in reply to 87231
Anonymous:
Simple, ban the Irish and the Scots.


And the Vulcans.

Re: Poor Mr. O'Hare

2006-08-22 15:13 • by Dom
87277 in reply to 87248
Anonymous:
DZ-Jay:

There are certainly other frameworks for developing web applications apart from ASP or PHP, and some of them focus on RAD, some of them even better, faster, and more robust and secure than your precious ColdFusion.  But I most definitely wouldn't call ColdFusion a "Real Programming Language".

    -dZ.



Name one. 

And I didn't say it's a real programming language.  I said it's a "Real Web Programming Language".  It has not much use outside the web world, but in the web world it's one of the most robust, RAD platforms out there.  Seriously.  I dare you.  Name one other programming language that even comes close to CF in terms of RAD. 



who ever told you that RAD is good for you? Ever heard about PAD? (*propper* application development)

Re: Poor Mr. O'Hare

2006-08-22 15:15 • by BlackTigerX

so of course the fix was to put:


if (sLogin == "O'Reily") sLogin = "O''Reily";
if (sLogin == "Robert O'Hare") sLogin = "Robert O''Hare";


maybe we could create a funcion to look for "O'" and replace it with "O''"!!!


done!

Re: Poor Mr. O'Hare

2006-08-22 15:16 • by Rich
87279 in reply to 87254
If an organization has been using SSNs as their customer identifier, and enough customers have finally complained enough that they realize they have to stop, then they give out IDs in the invalid range.

My 'SSN' at a local college is a '999'.

Re: Poor Mr. O'Hare

2006-08-22 15:16 • by BlackTigerX
87280 in reply to 87274
Bus Raker:
richleick:
Alex Papadimoulis:

When developing an application that uses in-line SQL queries, it's essential to protect against "SQL Injection", i.e. the insertion of SQL code as a result of a string concatenation. For example, if productNum comes directly from user input, it might contain a malicious string, such as "'; DROP DATABASE --"



myQuery = "SELECT Prod_Name FROM Products WHERE Prod_Num='" + productNum "';";

The best way to do this is through "parameterized queries," which lets the database libraries take care of it. The next best way is to write your own escaping functions. And the next best way is to replace all instances of "O'Reily" with "O''Reily".


Close.  Add the use of stored procedures and I'm all for it.  Oh wait, that would mean if you are using an earlier version of MySQL you probably never heard of these.


Uh ... I think parameterized queries = stored procedures.  Is there another kind I don't know about?



uh?...


parameterized queries != stored procedures

Re: Poor Mr. O'Hare

2006-08-22 15:16 • by Bus Raker
87281 in reply to 87235

Anonymous:


Actually the best way of doing it is to use a real web programming language like ColdFusion, which will do all the escaping for you. 



Can this be tommorow's WTF?  I mean, how many layers of application does one really need?  Oops .. guess I am including .net with that blanket statement.  Hmmm...


http://en.wikipedia.org/wiki/Coldfusion#Criticism


 

« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7 | Page 8Next »

Add Comment