Escape user search filters#404
Conversation
Greptile SummaryThis PR closes a wildcard-injection gap in
Confidence Score: 5/5Safe to merge — the change is a one-character addition to a regex that is already well-guarded by the surrounding escaping logic and has end-to-end test coverage. The fix is minimal and correct: adding No files require special attention. The only follow-up worth doing is updating the Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Route as GET /api/users/search
participant Escape as escapePostgrestSearchValue
participant Supabase
Client->>Route: "?q=user%*input_,v1.2"
Route->>Route: "URL-decode → "user%*input_,v1.2""
Route->>Escape: "escapePostgrestSearchValue("user%*input_,v1.2")"
Escape-->>Route: "user\%\*input\_\,v1\.2"
Route->>Supabase: ".ilike("username", "user\%\*input\_\,v1\.2%")"
Supabase-->>Route: matching rows (literal prefix only)
Route-->>Client: "{ users: [...] }"
Reviews (2): Last reviewed commit: "Escape user search wildcard aliases" | Re-trigger Greptile |
Fixes /api/users/search treating %, _, comma, and dot characters in username prefixes as PostgREST/LIKE syntax. The endpoint now escapes the query before passing it to ilike so usernames are matched literally while preserving the existing prefix-search behavior.
Validation: