c# - Sql Injection Attacks and Subsonic -
If I use subsonic to create DAL for my web project, then do I have to stop the SQL injection attacks Need to worry?
It depends on how you build your questions. If you do not use the parameters, writing unsafe questions with the subsonic is absolutely possible.
// Bad example: String SQL = "Delete from product where product name =" + rawUserInput; QueryCommand qry = New Query Commands (SQL, Product. Schema.Provider.Name); DataService.ExecuteQuery (qry); // should be: string sql = "delete from product where ProductName = @TargetName"; QueryCommand qry = New Query Commands (SQL, Product. Schema.Provider.Name); Qry.AddParamter ("@ TargetName", rawUserInput, DbType.String); DataService.ExecuteQuery (qry);
Comments
Post a Comment