Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    var pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); Commented Dec 22, 2020 at 23:32
  • Not a solution (@ControlAltDel gave you that) but why do you need to test for it? are you sending whatever you get in as raw SQL instead of parameters? Or are you just out to block bots who try to do it? Commented Dec 22, 2020 at 23:34
  • Frame Challenge: The fact that you think you need this indicates you are doing it wrong. If you use a JSON parser, parameterized queries (with "?" for values) and prepared statements, you completely prevent Little Bobby Tables from messing with your database. You can generate SQL dynamically if needed, but never provide data values as literals. Commented Dec 23, 2020 at 1:08
  • This is used to create spring filter. I'm working with legacy apps which builds dynamic SQL by joining string, so it's prone to sql injection. Rather than fix all the legacy apps, I try to create web filter that blocks sql scripts upfront Commented Dec 24, 2020 at 1:20
  • @Timothy - Just so that you know that >you< will get the blame if your filters are ineffective and your site gets hacked. Commented Dec 24, 2020 at 1:29