So say I find that I’m getting requests to my web application that are obviously SQL injection attacks or similar. I write a short test to check request variables for “naughty” strings. If I find one, what code ought I to respond with?
I’m thinking of returning “403 Forbidden” and no content, but I’m not sure.
I would think
403 Forbiddenmeans that the resource shouldn’t be accessed.I’d thus use
400 Bad Requestinstead. After all, the user is allowed to the page so long as they’re making a legitimate request.