adamsaghy commented on code in PR #2932:
URL: https://github.com/apache/fineract/pull/2932#discussion_r1107319836
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLInjectionValidator.java:
##########
@@ -37,23 +38,32 @@ private SQLInjectionValidator() {
private static final String SQL_PATTERN = "[a-zA-Z_=,\\-'!><.?\"`%
()0-9*\n\r]*";
+ // TODO: see here https://rails-sqli.org for and
+ //
https://larrysteinle.com/2011/02/20/use-regular-expressions-to-detect-sql-code-injection
more examples
+ private static final List<String> INJECTION_PATTERNS =
List.of("(?i).*[or|and]\s*[\"']?-1[\"']?\\s*(-*).*",
+
"(?i).*\\s+[\"']?(\\d+)[\"']?\\s*=\\s*[\"']?(\\1)[\"']?\\s*(-*).*");
+
public static void validateSQLInput(final String sqlSearch) {
if (StringUtils.isBlank(sqlSearch)) {
return;
}
+
+ // TODO: this should be replaced by INJECTION_PATTERNS
Review Comment:
Is the TODO for future?
Should we replace it now?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]