FINERACT-1724

- [x] eliminate sonar security hotspots
This commit is contained in:
Janos Haber
2022-11-25 10:58:59 +01:00
committed by Arnold Gálovics
parent 5079059405
commit 3f0872d1ec
4 changed files with 14 additions and 6 deletions
@@ -384,7 +384,8 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
try {
final GLJournalEntryMapper rm = new GLJournalEntryMapper(associationParametersData);
final String sql = "select " + rm.schema() + " where journalEntry.id = ?";
// Programmatic query, disable sonar issue
final String sql = "select " + rm.schema() + " where journalEntry.id = ?"; // NOSONAR
return this.jdbcTemplate.queryForObject(sql, rm, glJournalEntryId);
} catch (final EmptyResultDataAccessException e) {
@@ -109,7 +109,8 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
@Override
public ProvisioningEntryData retrieveProvisioningEntryData(Long entryId) {
ProvisioningEntryDataMapperWithSumReserved mapper1 = new ProvisioningEntryDataMapperWithSumReserved();
final String sql = "select" + mapper1.getSchema() + " where entry.id = ? group by entry.id, created.username, modified.username";
// Programmatic query, disable sonar
final String sql = "select" + mapper1.getSchema() + " where entry.id = ? group by entry.id, created.username, modified.username"; // NOSONAR
return this.jdbcTemplate.queryForObject(sql, mapper1, entryId);
}
@@ -23,8 +23,9 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.regex.Pattern;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import javax.servlet.FilterChain;
@@ -56,7 +57,12 @@ public class LoanCOBApiFilter extends OncePerRequestFilter {
private final InlineLoanCOBExecutorServiceImpl inlineLoanCOBExecutorService;
private static final List<HttpMethod> HTTP_METHODS = List.of(HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE);
private static final Function<String, Boolean> URL_FUNCTION = s -> s.matches("/loans/\\d+.*") || s.matches("/loans/glimAccount/\\d+.*");
private static final Pattern LOAN_PATH_PATTERN = Pattern.compile("/loans/\\d+");
private static final Pattern LOAN_GLIMACCOUNT_PATH_PATTERN = Pattern.compile("/loans/glimAccount/\\d+");
private static final Predicate<String> URL_FUNCTION = s -> LOAN_PATH_PATTERN.matcher(s).find()
|| LOAN_GLIMACCOUNT_PATH_PATTERN.matcher(s).find();
private static final Integer LOAN_ID_INDEX_IN_URL = 2;
private static final Integer GLIM_ID_INDEX_IN_URL = 3;
private static final Integer GLIM_STRING_INDEX_IN_URL = 2;
@@ -143,7 +149,7 @@ public class LoanCOBApiFilter extends OncePerRequestFilter {
if (StringUtils.isBlank(request.getPathInfo())) {
return false;
}
return HTTP_METHODS.contains(HttpMethod.valueOf(request.getMethod())) && URL_FUNCTION.apply(request.getPathInfo());
return HTTP_METHODS.contains(HttpMethod.valueOf(request.getMethod())) && URL_FUNCTION.test(request.getPathInfo());
}
private boolean isGlim(Supplier<Stream<String>> streamSupplier) {
@@ -264,7 +264,7 @@ public class SavingsAccountChargeReadPlatformServiceImpl implements SavingsAccou
+ " where sac.charge_due_date is not null and sac.charge_due_date <= ? and sac.waived = false and sac.is_paid_derived=false and sac.is_active=true and sa.status_enum = ? "
+ " order by sac.charge_due_date ";
return this.jdbcTemplate.query(sql, this.chargeDueMapper,
return this.jdbcTemplate.query(sql, this.chargeDueMapper, // NOSONAR
new Object[] { DateUtils.getBusinessLocalDate(), SavingsAccountStatusType.ACTIVE.getValue() }); // NOSONAR
}