crambo70 opened a new pull request, #5492: URL: https://github.com/apache/fineract/pull/5492
## Summary Replaces ~30 SQL injection vulnerabilities across 7 files with JDBC PreparedStatement parameterized queries. These vulnerabilities existed in the datatable, survey, email, and deposit account services — core infrastructure used by microfinance institutions serving unbanked populations worldwide. **Do good with AI.** ## Changes - **DatatableWriteServiceImpl**: Replace string-concatenated DELETE, INSERT, and SELECT queries with `?` placeholders. Refactor permission registration from raw SQL string building (`getPermissionSql()`) to parameterized `registerPermissions()` method. Fixes injection vectors in `deleteColumnCodeMapping`, `registerColumnCodeMapping`, `getCodeIdForColumn`, `parseDatatableColumnForDrop`, `isDatatableAttachedToEntityDatatableCheck`, `deregisterDatatable`, and datatable entry deletion. - **DatatableUtil**: Parameterize all `appTableId` (Long) and `officeHierarchy` (String LIKE) values in `dataScopedSQL()` across all entity scoping branches (LOAN, SAVINGS, SAVINGS_TRANSACTION, CLIENT, GROUP, CENTER, OFFICE, PRODUCT). Refactor `getOfficeJoinCondition`, `getGroupOfficeJoinCondition`, and `getClientOfficeJoinCondition` helpers to use `?` placeholders. Parameterize `retrieveDataTableGenericResultSet()`. - **GenericDataService/Impl**: Add parameterized overload `fillResultsetRowData(sql, headers, args...)` to support prepared statement execution from DatatableUtil. - **DatatableReadServiceImpl**: Parameterize `appTableId` in `countDatatableEntries()` WHERE clause. - **WriteSurveyServiceImpl**: Remove duplicate vulnerable `getPermissionSql()` and unused dependencies (`DatabaseSpecificSQLGenerator`, `DatatableReadService`). Delegate to safe `DatatableWriteService.registerDatatable(command)`. - **DepositAccountReadPlatformServiceImpl**: Add missing `paginationParametersDataValidator.validateParameterValues()` call in `retrieveAll()` to match the validation already present in `retrieveAllPaged()`. ## Test plan - [x] `./gradlew compileJava` — BUILD SUCCESSFUL (111 tasks) - [x] `./gradlew test -x :twofactor-tests:test -x :oauth2-tests:test` — all tests pass - [ ] Integration tests with MariaDB/PostgreSQL tenant databases (requires Docker environment) - [ ] Manual verification of datatable CRUD operations via REST API - [ ] Manual verification of survey registration - [ ] Manual verification of deposit account listing with pagination parameters 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
