adfinis / timed

Monorepo for the Timed time-tracking application
GNU Affero General Public License v3.0
6 stars 5 forks source link

feat: comment search #283

Closed c0rydoras closed 1 month ago

c0rydoras commented 3 months ago

implements: https://github.com/adfinis/timed/issues/29

winged commented 3 months ago

Quick question: how will this be used? As you note yourself, this may cause performance problems, not only for malicious queries (which I think we can neglect here) but also for regular users who don't know when a RE query will cause the DB to break down

c0rydoras commented 3 months ago

@winged https://github.com/adfinis/timed/issues/29 describes that

winged commented 3 months ago

@winged #29 describes that

Thanks! Still a small explanation in the PR (and commit message!) won't hurt, along with a link in the original comment to the issue. Just to make things easier when we need to dig for reasons in 5 years

c0rydoras commented 3 months ago

@winged i think we could use the search lookup

c0rydoras commented 3 months ago

I switched to postgres full text search instead of regex, this should make it so that ReDoS is no longer an issue, and it's probably more user friendly for nontechnical users :)

winged commented 3 months ago

I much prefer the FTS search! However this will need an appropriate index on the comment field, otherwise it's gonna be rather slow, as it needs a full table scan each time, same as the regex lookup would have.

Here's how you can do that: https://docs.djangoproject.com/en/5.0/ref/contrib/postgres/search/#performance