FINERACT-1969 SQL Injection exception thrown even if no insecure string is in the input
This commit is contained in:
+6
-8
@@ -314,7 +314,7 @@ public class DatatablesApiResource {
|
||||
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.createDatatable(datatable, apptableId, null) //
|
||||
.createDatatableEntry(datatable, apptableId, null) //
|
||||
.withJson(apiRequestBodyAsJson) //
|
||||
.build();
|
||||
|
||||
@@ -336,7 +336,7 @@ public class DatatablesApiResource {
|
||||
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateDatatable(datatable, apptableId, null) //
|
||||
.updateDatatableEntry(datatable, apptableId, null) //
|
||||
.withJson(apiRequestBodyAsJson) //
|
||||
.build();
|
||||
|
||||
@@ -359,7 +359,7 @@ public class DatatablesApiResource {
|
||||
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.updateDatatable(datatable, apptableId, datatableId) //
|
||||
.updateDatatableEntry(datatable, apptableId, datatableId) //
|
||||
.withJson(apiRequestBodyAsJson) //
|
||||
.build();
|
||||
|
||||
@@ -380,7 +380,7 @@ public class DatatablesApiResource {
|
||||
@PathParam("apptableId") @Parameter(description = "apptableId") final Long apptableId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.deleteDatatable(datatable, apptableId, null) //
|
||||
.deleteDatatableEntry(datatable, apptableId, null) //
|
||||
.build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
@@ -396,13 +396,11 @@ public class DatatablesApiResource {
|
||||
+ "\n")
|
||||
@ApiResponses({
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = DatatablesApiResourceSwagger.DeleteDataTablesDatatableAppTableIdDatatableIdResponse.class))) })
|
||||
public String deleteDatatableEntries(
|
||||
@PathParam("datatable") @Parameter(description = "datatable", example = "{}") final String datatable,
|
||||
public String deleteDatatableEntry(@PathParam("datatable") @Parameter(description = "datatable", example = "{}") final String datatable,
|
||||
@PathParam("apptableId") @Parameter(description = "apptableId") final Long apptableId,
|
||||
@PathParam("datatableId") @Parameter(description = "datatableId") final Long datatableId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.deleteDatatable(datatable, apptableId, datatableId) //
|
||||
.deleteDatatableEntry(datatable, apptableId, datatableId) //
|
||||
.build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
+1
-14
@@ -21,7 +21,6 @@ package org.apache.fineract.infrastructure.dataqueries.handler;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.dataqueries.service.ReadWriteNonCoreDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -40,18 +39,6 @@ public class DeleteOneToManyDatatableEntryCommandHandler implements NewCommandSo
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
final CommandProcessingResult commandProcessingResult = this.writePlatformService.deleteDatatableEntry(command.entityName(),
|
||||
command.entityId(), command.subentityId());
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.build();
|
||||
return this.writePlatformService.deleteDatatableEntry(command.entityName(), command.entityId(), command.subentityId(), command);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-14
@@ -21,7 +21,6 @@ package org.apache.fineract.infrastructure.dataqueries.handler;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.dataqueries.service.ReadWriteNonCoreDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -40,18 +39,6 @@ public class DeleteOneToOneDatatableEntryCommandHandler implements NewCommandSou
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
final CommandProcessingResult commandProcessingResult = this.writePlatformService.deleteDatatableEntries(command.entityName(),
|
||||
command.entityId());
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.withOfficeId(commandProcessingResult.getOfficeId()) //
|
||||
.withGroupId(commandProcessingResult.getGroupId()) //
|
||||
.withClientId(commandProcessingResult.getClientId()) //
|
||||
.withSavingsId(commandProcessingResult.getSavingsId()) //
|
||||
.withLoanId(commandProcessingResult.getLoanId()) //
|
||||
.build();
|
||||
return this.writePlatformService.deleteDatatableEntries(command.entityName(), command.entityId(), command);
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -272,5 +272,4 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData
|
||||
throw new PlatformDataIntegrityException("error.msg.report.unknown.data.integrity.issue",
|
||||
"Unknown data integrity issue with resource: " + realCause.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -68,9 +68,9 @@ public interface ReadWriteNonCoreDataService {
|
||||
|
||||
CommandProcessingResult updateDatatableEntryOneToMany(String datatable, Long appTableId, Long datatableId, JsonCommand command);
|
||||
|
||||
CommandProcessingResult deleteDatatableEntries(String datatable, Long appTableId);
|
||||
CommandProcessingResult deleteDatatableEntries(String datatable, Long appTableId, JsonCommand command);
|
||||
|
||||
CommandProcessingResult deleteDatatableEntry(String datatable, Long appTableId, Long datatableId);
|
||||
CommandProcessingResult deleteDatatableEntry(String datatable, Long appTableId, Long datatableId, JsonCommand command);
|
||||
|
||||
String getTableName(String Url);
|
||||
|
||||
|
||||
+572
-842
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -174,7 +174,7 @@ public class SurveyApiResource {
|
||||
@PathParam("fulfilledId") final Long fulfilledId) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder() //
|
||||
.deleteDatatable(surveyName, clientId, fulfilledId) //
|
||||
.deleteDatatableEntry(surveyName, clientId, fulfilledId) //
|
||||
.build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
+3
@@ -31,6 +31,9 @@ public final class SearchConstants {
|
||||
public static final String API_PARAM_VALUES = "values";
|
||||
public static final String API_PARAM_TABLE = "table";
|
||||
public static final String API_PARAM_QUERY = "query";
|
||||
public static final String API_PARAM_DATE_FORMAT = "dateFormat";
|
||||
public static final String API_PARAM_DATETIME_FORMAT = "dateTimeFormat";
|
||||
public static final String API_PARAM_LOCALE = "locale";
|
||||
|
||||
private SearchConstants() {}
|
||||
|
||||
|
||||
+1
-2
@@ -86,8 +86,7 @@ public final class SearchUtil {
|
||||
@NotNull List<String> resultColumns, @NotNull List<JsonObject> results) {
|
||||
JsonObject json = new JsonObject();
|
||||
for (int i = 0; i < selectColumns.size(); i++) {
|
||||
String sCol = selectColumns.get(i).replaceAll("\"", "");
|
||||
Object rowValue = rowSet.getObject(sCol);
|
||||
Object rowValue = rowSet.getObject(selectColumns.get(i));
|
||||
if (rowValue != null) {
|
||||
String rCol = resultColumns.get(i);
|
||||
if (rowValue instanceof Character) {
|
||||
|
||||
Reference in New Issue
Block a user