Forum Moderators: phranque
Since we don't know exactly what your devloper said, or what his intent was, we don't know if he means:
A) "You don't need to use stored procedures to prevent against SQL injection attacks, because the cleanuptext fuunction provides the same level of security," or
B) "You don't need to use stored procedures at all."
I would be suspicious if he is tryig to say B- it sounds ike he is really saying "I don't know how to code stored procedures."
And I think Steerpike meant "from Access to SQL," not the other way around. :)
My developer thinks his cleanuptext is good enough on its own to secure the website against SQL attacks.
The problem I have is my site is a community site so I have to allow words like Drop, Select, Union etc. So the only thing his cleanup code does is replace the symbol keys.
function cleanuptext(strval)
on error resume next
'strval = Replace(strval, "exec", "")
'strval = Replace(strval, "select", "")
'strval = Replace(strval, "drop", "")
'strval = Replace(strval, "insert", "")
'strval = Replace(strval, "delete", "")
'strval = Replace(strval, "join", "")
'strval = Replace(strval, "script", "")
'strval = Replace(strval, "EXEC", "")
'strval = Replace(strval, "SELECT", "")
'strval = Replace(strval, "DROP", "")
'strval = Replace(strval, "INSERT", "")
'strval = Replace(strval, "DELETE", "")
'strval = Replace(strval, "JOIN", "")
'strval = Replace(strval, "SCRIPT", "")
'strval = Replace(strval, "Exec", "")
'strval = Replace(strval, "Select", "")
'strval = Replace(strval, "Drop", "")
'strval = Replace(strval, "Insert", "")
'strval = Replace(strval, "Delete", "")
'strval = Replace(strval, "Join", "")
'strval = Replace(strval, "Script", "")
strval = Replace(strval, "<", "(")
strval = Replace(strval, ">", ")")
strval = Replace(strval, "=", "equals")
strval = Replace(strval, "'", "")
strval = Replace(strval, "XP_", "")
strval = Replace(strval, "--", "")
strval = Replace(strval, "[", "(")
strval = Replace(strval, "]", ")")
on error goto 0
cleanuptext = strval
end function
How do I ensure words like Select and Drop only appear in the safe parts of SQL?
In any case; such a simplistic approach is full of holes; just take the case of:
DRDROPOP
Your cleanuptext function will replace it with:
DROP
Likewise: XPXP__ etc.
Great ;)
If you can't persuade your programmer to study a little more SQL, then you need to either: