Soldato
- Joined
- 18 Oct 2002
- Posts
- 16,053
- Location
- The land of milk & beans
Hey all,
A while back someone posted a regexp function which would check for the usual elements of a SQL query to make sure no injections were happening - all good. The only problem is I've got this on a site now and it's causing a few issues.
For example, the phrase 'Daddy or chips?' is being flagged as an injection attempt.
I've looked through the expression and can't see exactly where it's coming from, could any of you kindly souls help me out?
Ta muchly!
A while back someone posted a regexp function which would check for the usual elements of a SQL query to make sure no injections were happening - all good. The only problem is I've got this on a site now and it's causing a few issues.
For example, the phrase 'Daddy or chips?' is being flagged as an injection attempt.
I've looked through the expression and can't see exactly where it's coming from, could any of you kindly souls help me out?
Code:
szPattern = "SELECT((.|\s)*?)FROM((.|\s)*?)$|" & _
"UPDATE((.|\s)*?)SET((.|\s)*?)$|" & _
"INSERT[\s]+INTO((.|\s)*?)$|" & _
"DELETE[\s]+FROM((.|\s)*?)$|" & _
"(DROP|CREATE|ALTER|TRUNCATE)[\s]+TABLE[\s]+((.|\s)*?)$|" & _
"UNION[\s]+(ALL|SELECT){1}[\s]+((.|\s)*?)$|" & _
"DECLARE((.|\s)*?)[\s]+(NVARCHAR|VARCHAR|CHAR){1}((.|\s)*?)$|" & _
"AND[\s]+((.|\s)*?)CONVERT((.|\s)*?)SP_PASSWORD$|" & _
"[\r?\n|\r|\x00|\x1a]|[-]{2}"