-
Notifications
You must be signed in to change notification settings - Fork 42
Escape public listing search filters #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,8 +54,8 @@ describe("sanitizeSearchParams", () => { | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| describe("escapePostgrestSearchValue", () => { | ||||||||||||||||||||||||||||||||||||||||||
| it("escapes LIKE wildcards and PostgREST filter punctuation", () => { | ||||||||||||||||||||||||||||||||||||||||||
| expect(escapePostgrestSearchValue("100%_match,(v1.2)")).toBe( | ||||||||||||||||||||||||||||||||||||||||||
| "100\\%\\_match\\,\\(v1\\.2\\)" | ||||||||||||||||||||||||||||||||||||||||||
| expect(escapePostgrestSearchValue("100%_match*,(v1.2)")).toBe( | ||||||||||||||||||||||||||||||||||||||||||
| "100\\%\\_match\\*\\,\\(v1\\.2\\)" | ||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
55
to
61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
affiliates/page.tsxslices the search value to 200 characters before escaping (with a comment citing issue #57), butdirectory,for-hire,gigs,mcp,prompts, andskillspages passqueryParams.searchdirectly without any length limit. A very long search string still produces an oversized PostgREST filter string on those routes. Since this PR is touching all of them, it would be a natural place to apply the same.slice(0, 200)guard consistently.