Skip to content

fix: resolve transaction lookup, compliance search injection, dashboa… - #1934

Merged
sublime247 merged 1 commit into
sublime247:mainfrom
muazumikail1915-create:fix/multi-bug-fixes-1783-1784-1785-1786
Aug 31, 2026
Merged

fix: resolve transaction lookup, compliance search injection, dashboa…#1934
sublime247 merged 1 commit into
sublime247:mainfrom
muazumikail1915-create:fix/multi-bug-fixes-1783-1784-1785-1786

Conversation

@muazumikail1915-create

Copy link
Copy Markdown
Contributor

Summary

Why

  1. [Bug] Fix transaction lookup by reference number returning incorrect records #1783 (Transaction Reference Lookup): Unsanitized or untrimmed reference number parameters caused lookups to fail or return mismatched records when whitespace or reference-number-formatted identifiers were supplied.
  2. [Bug] Prevent SQL injection vulnerability in dynamic compliance search query #1784 (SQL Injection in Compliance Search): Unescaped wildcard characters (%, _, \) in dynamic ILIKE compliance document queries allowed arbitrary pattern matching and potential query manipulation.
  3. [Bug] Fix session timeout redirect loop on admin dashboard #1785 (Session Timeout Loop on Dashboard): Background polling on the admin dashboard (setInterval) continued issuing requests after session expiration, triggering recurring 401 unauthenticated errors and potential redirect loops.
  4. [Bug] Fix validation of phone numbers with country prefix overrides #1786 (Phone Number Validation Overrides): Phone validation and provider prefix matching failed for valid national-format numbers when operating under country prefix overrides because national prefixes were not resolved against the target provider's country calling code before prefix verification.

Implementation

  • src/models/transaction.ts: Validated input string types and trimmed reference numbers in findByReferenceNumber and buildListWhere.
  • src/controllers/transactionController.ts: Added fallback lookup to findByReferenceNumber in getTransactionHandler when findById returns null.
  • src/utils/transactionFilters.ts: Added support for referenceNumber, reference, and reference_number query parameters with string trimming.
  • src/utils/referenceGenerator.ts: Standardized reference date generation using UTC calendar methods to avoid cross-timezone day boundary drifts.
  • src/models/complianceDocument.ts: Escaped special characters (%, _, \) and added ESCAPE '\\' to ILIKE search clauses in list().
  • src/routes/admin.ts: Added 401/403 session expiration checks in HTML dashboard views (/financial/dashboard, /audit-logs/view, /compliance/knowledge-base) to cancel active polling timers and display an explicit login link without redirect loops.
  • src/utils/phoneUtils.ts: Updated validatePhoneProviderMatch, detectProvider, and formatPhoneForProvider to accept optional countryOverride?: CountryCode and normalize local/national phone numbers by resolving country calling codes before checking network prefixes.
  • src/utils/tests/phoneUtils.test.ts: Added comprehensive unit tests covering phone numbers with country prefix overrides across African provider regions.

Testing

# Targeted unit tests
npx jest tests/utils/transactionFilters.test.ts src/utils/__tests__/phoneUtils.test.ts tests/utils/referenceGenerator.test.ts src/routes/__tests__/adminComplianceKnowledgeBase.test.ts

# TypeScript type check
npx tsc --noEmit

Verification Results
tests/utils/transactionFilters.test.ts: Passed (19/19 tests)
src/utils/__tests__/phoneUtils.test.ts: Passed (35/35 tests)
tests/utils/referenceGenerator.test.ts: Passed (7/7 tests)
src/routes/__tests__/adminComplianceKnowledgeBase.test.ts: Passed (7/7 tests)
Total: 70/70 unit tests passed; 0 TypeScript errors.
Scope / Risk
Affected Area: Transaction lookup controller/models, compliance document filtering, admin dashboard frontend scripts, and phone utility validation helpers.
Breaking Changes: None. All changes are backward compatible with existing API parameters and response shapes.
Issues
Closes #1783 Closes #1784 Closes #1785 Closes #1786

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@muazumikail1915-create Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@sublime247
sublime247 merged commit be65a6c into sublime247:main Aug 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants