FINERACT-1969 SQL Injection exception thrown even if no insecure string is in the input
This commit is contained in:
+3
-3
@@ -718,19 +718,19 @@ public class CommandWrapperBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandWrapperBuilder createDatatable(final String datatable, final Long apptableId, final Long datatableId) {
|
||||
public CommandWrapperBuilder createDatatableEntry(final String datatable, final Long apptableId, final Long datatableId) {
|
||||
this.actionName = "CREATE";
|
||||
commonDatatableSettings(datatable, apptableId, datatableId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandWrapperBuilder updateDatatable(final String datatable, final Long apptableId, final Long datatableId) {
|
||||
public CommandWrapperBuilder updateDatatableEntry(final String datatable, final Long apptableId, final Long datatableId) {
|
||||
this.actionName = "UPDATE";
|
||||
commonDatatableSettings(datatable, apptableId, datatableId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandWrapperBuilder deleteDatatable(final String datatable, final Long apptableId, final Long datatableId) {
|
||||
public CommandWrapperBuilder deleteDatatableEntry(final String datatable, final Long apptableId, final Long datatableId) {
|
||||
this.actionName = "DELETE";
|
||||
commonDatatableSettings(datatable, apptableId, datatableId);
|
||||
return this;
|
||||
|
||||
+9
@@ -24,6 +24,7 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
@@ -78,6 +79,14 @@ public final class DateUtils {
|
||||
return LocalDateTime.now(ZoneId.systemDefault()).truncatedTo(ChronoUnit.SECONDS);
|
||||
}
|
||||
|
||||
public static LocalDateTime getAuditLocalDateTime() {
|
||||
return LocalDateTime.now(ZoneId.of("UTC"));
|
||||
}
|
||||
|
||||
public static OffsetDateTime getAuditOffsetDateTime() {
|
||||
return OffsetDateTime.now(ZoneOffset.UTC);
|
||||
}
|
||||
|
||||
public static boolean isDateInTheFuture(final LocalDate localDate) {
|
||||
return localDate.isAfter(getBusinessLocalDate());
|
||||
}
|
||||
|
||||
+15
@@ -248,4 +248,19 @@ public class DatabaseSpecificSQLGenerator {
|
||||
return orderBy + orders.stream().map(e -> String.join(" ", alias(escape(e.getProperty()), alias), e.getDirection().name()))
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
public String buildInsert(@NotNull String definition, Collection<String> fields) {
|
||||
if (fields == null || fields.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return "INSERT INTO " + escape(definition) + '(' + fields.stream().map(this::escape).collect(Collectors.joining(", "))
|
||||
+ ") VALUES (?" + ", ?".repeat(fields.size() - 1) + ')';
|
||||
}
|
||||
|
||||
public String buildUpdate(@NotNull String definition, Collection<String> fields) {
|
||||
if (fields == null || fields.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return "UPDATE " + escape(definition) + " SET " + fields.stream().map(e -> escape(e) + " = ?").collect(Collectors.joining(", "));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user