//Bad Person
username = "lastname'; drop table user--"
//Good Programmer
query = "select * from users where name like %[username]%";
input = {"username":"frank"};
result = execute(query,input);
//Bad Programmer
query = "select * from users where name like '%"+username+"%'";
result = execute(query, {});
vs //Bad Person
String username = "lastname'; drop table user--"
//Good Programmer
Query q = new Query("select * from users where name like %[username]%");
Input input = new Input(username);
q.addInput(input);
Result r = q.execute();
//Bad Programmer
Query q = new Query("select * from users where name like '%"+username+"%'");
Result r = q.execute();
Could you solve this better using a static system? Right now I see no difference between the good and bad Query q = new Query("select * from users where id = (id)");
QueryParam qp = new QueryParam("(id)",25);
q.addParam(qp);
ResultSet rs = q.execute();
public class Query {
public ResultSet execute() {
for(QueryParam qp : this.getQueryParams()) {
this.getSql().replace(qp.getId(),qp.getValue());
}
super.execute(sql);
}
}
That's all type safe. So it should be good right? class="st_facebook_large"
displaytext="Facebook"
st_url='http://www.hardrock.com/locations/cafes3/events.aspx?locationid=108&MIBenumID
Could it be that it is just throwing this error because of the unencoded ampersand? And that since it is part of some MS/ASP.net setup it is everywhere?
What scale do you see it? And what's the acceptable/unacceptable threshold? Right now you are jumping squarely into "this isn't an issue please move on and grow thicker skin", which is a lousy place to start a discussion.
> entire industry freaking out.
I really don't think my or your opinion matters, instead perhaps we should encourage more bloggers like this to speak out so we can see if there really is a problem. You know, encourage more data from the source instead of anecdotes like your wife and math?
Because if there is a problem then we should solve it, right?