Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Version: 1.0.0
Created: 2026-01-08
Status: ✅ Complete

Overview

This document tracks the migration of existing search/filter/sort/pagination code to the centralized PF-57 framework.

Migration Status

Legend

  • ✅ Complete
  • 🔄 In Progress
  • ⏳ Pending
  • ❌ Blocked

Platform Foundation (PF) Modules

FilePatternsSecurity FixStatus
src/platform/documents/useDocumentSearch.tsFilter, Sort, FTSN/A✅ Complete
src/platform/data-manager/hooks/useRawData.tsSearch, Pagination, Sort✅ Added escaping✅ Complete

HR Core Modules

FilePatternsSecurity FixStatus
src/cores/hr/hooks/useCandidates.tsSearch, Filter, Pagination, SortReplaced local escape✅ Complete
src/cores/hr/hooks/useEmployeeList.tsSearch, Filter, Pagination, Sort✅ Added escaping✅ Complete
src/cores/hr/hooks/useApplications.tsFilter, Pagination, SortN/A✅ Complete
src/cores/hr/hooks/useJobPostings.tsSearch, Filter, Pagination, Sort✅ Added escaping✅ Complete

FA Core Modules

FilePatternsSecurity FixStatus
src/cores/fa/hooks/useVendors.tsSearch, Filter, Sort✅ Added escaping✅ Complete
src/cores/fa/hooks/usePurchaseOrders.tsSearch, Filter, Sort✅ Added escaping✅ Complete
src/cores/fa/hooks/useJournalEntries.tsSortN/A✅ Complete

Security Fixes Summary

The following hooks had unescaped ILIKE search terms which could allow pattern injection:
HookBeforeAfter
useRawData%${search}%escapeILikePattern(search)
useEmployeeList%${filters.search}%buildILikeOrConditions()
useJobPostings%${filters.search}%escapeILikePattern()
useVendors%${filters.searchTerm}%buildILikeOrConditions()
usePurchaseOrders%${filters.search}%buildILikeOrConditions()

Framework Utilities Used

UtilityFromPurpose
escapeILikePattern@/platform/searchEscape special chars in ILIKE
buildILikeOrConditions@/platform/searchBuild safe OR conditions
calculateRange@/platform/paginationCalculate Supabase .range()
applySorting@/platform/sortApply sort config to query
createSortConfig@/platform/sortCreate single-field sort

Backwards Compatibility

A backwards compatibility module was created at src/shared/lib/utils/search.ts with deprecated re-exports to ease gradual migration of other files.

Validation Checklist

  • All hooks use centralized framework utilities
  • No duplicate search/filter/sort/pagination code
  • All search terms properly escaped
  • Pagination uses calculateRange()
  • Sorting uses applySorting()
  • Backwards compatibility exports created
  • Unit tests created (42 test cases)
  • Integration tests created (8 test cases)
  • E2E tests created (6 test flows)
  • All tasks marked complete in PF-57-TASKS.md
  • Implementation log updated