![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
How can I stop/prevent SQL server from running compound SQL statements. I do not want the server to run multiple update/delete/insert/select statements as a batch. Is there an option? |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Khaled Afiouni (post (AT) afiouni (DOT) com) writes: How can I stop/prevent SQL server from running compound SQL statements. I do not want the server to run multiple update/delete/insert/select statements as a batch. Is there an option? No, there is no such option. Please explain what your real problem is, and maybe we can find a suggestion. What you are asking for right now does not really make sense? |
#5
| |||
| |||
|
|
Khaled Afiouni (post (AT) afiouni (DOT) com) writes: How can I stop/prevent SQL server from running compound SQL statements. I do not want the server to run multiple update/delete/insert/select statements as a batch. Is there an option? No, there is no such option. Please explain what your real problem is, and maybe we can find a suggestion. What you are asking for right now does not really make sense? |
#6
| |||
| |||
|
|
Actually I am checking for an ultimate solution to the SQL injection issues. |
#7
| |||
| |||
|
|
I am trying to find an ultimate solution to the SQL injection issues. In addition to verifying, validating and checking on the data entry fields, I would like to prevent compound statements from running and only allowing the first SQL statement to run. |
#8
| |||
| |||
|
|
Hello, How can I stop/prevent SQL server from running compound SQL statements. I do not want the server to run multiple update/delete/insert/select statements as a batch. Is there an option? /Kaf www.afiouni.com |
#9
| |||
| |||
|
|
Khaled Afiouni (post (AT) afiouni (DOT) com) writes: I am trying to find an ultimate solution to the SQL injection issues. In addition to verifying, validating and checking on the data entry fields, I would like to prevent compound statements from running and only allowing the first SQL statement to run. To do that you would have to add some middleware and have all your clients talk to that middleware, and this middleware would pass the code to SQL Server after validation and then pass the data back. Not for the faint of heart. And it would be a reduction in usability, since there sometimes be very good reason for an application to submit two commands one go. And you would not even be safe. You could intercept dynamic SQL created client side, but not dynamic SQL created in stored procedures. First step, is to let the users run the application with as few permissions as possible. Ideally, all access should be through stored procedures, and there should not be any dynamic SQL in the SPs as well. The users only needs EXEC permission to the procedures. Now, this may hamper usability, since some functions are easier to implement with dynamic SQL, not the least if you want performance. (Typically this is search functions where the users can search on a number of criterias.) But if you restrict access to SELECT on the table, an intruder cannot wreck your database. Next step is to write the SQL code properly. If you are constructing SQL code client-side, use prepared statements with placeholds for the parameters. Never build the entire string with values and all. You can also call sp_executesql directly through RPC methods, *not* as EXEC statements! If you use dynamic SQL in stored procedures, use sp_executesql to run your dynamic SQL, not EXEC(). For dynamic SQL on the client side, I have some articles on my web site: http://www.sommarskog.se/dynamic_sql.html http://www.sommarskog.se/dyn-search.html |
#10
| |||
| |||
|
|
After following this thread for a few go-rounds, perhaps it is worth asking, what is it that you are trying to achieve by stopping such compound commands? In particular, why is there SQL outside your control being posted to your server? No criticism of your system, just feels like your respondents could use a "bigger picture". "Khaled Afiouni" <post (AT) afiouni (DOT) com> wrote in message news:a5c90178.0407070152.17be0506 (AT) posting (DOT) google.com... Hello, How can I stop/prevent SQL server from running compound SQL statements. I do not want the server to run multiple update/delete/insert/select statements as a batch. Is there an option? /Kaf www.afiouni.com |
![]() |
| Thread Tools | |
| Display Modes | |
| |