Page MenuHomePhabricator

Limit the damage that degenerate project name typeahead queries can cause
ClosedPublic

Authored by epriestley on Aug 30 2017, 6:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 29, 11:23 PM
Unknown Object (File)
Mon, Jan 27, 3:12 PM
Unknown Object (File)
Fri, Jan 24, 6:30 PM
Unknown Object (File)
Tue, Jan 21, 3:26 PM
Unknown Object (File)
Tue, Jan 21, 12:41 PM
Unknown Object (File)
Fri, Jan 17, 3:52 PM
Unknown Object (File)
Jan 8 2025, 4:31 AM
Unknown Object (File)
Dec 9 2024, 12:20 PM
Subscribers
None

Details

Summary

See PHI47. When users copy/paste a wall of text into a project tokenizer, we can end up performing a very large number of JOINs.

These JOINs seem okay locally and on secure, but the install in PHI47 reports hitting issues.

Since these queries are almost certainly illegitimate (I think no one uses 5+ words to find a project), just limit the search to the 5 longest tokens.

Note that typing 6 tokens will still almost always work, since the UI does additional filtering. However, if you have 100+ projects named "a b c d e ..." and search for "a b c d e z", you may not hit it. This is so degenerate that it's hard to imagine any users encountering it.

This is a stopgap fix, I'll file something longer-term as a followup.

Test Plan

Used /typeahead/class/PhabricatorProjectDatasource/ to run queries. Saw the same results with shorter query plans for all reasonable queries.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable