Prevent the manipulation of search keyword suggestions

Aperta
#6,769 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend, search

Direzione di ricerca

Start by tracing SearchHandler::saveKeywordSuggestion() to SearchKeywordAction::registerSearch(), then inspect SearchKeywordAction::getSearchResultList() and the existing keyword storage. Determine how the application identifies guests and users and how it persists per-user search history; the issue does not name those files or tests. Done means guests still search without recording keywords and each registered user's keyword is counted only once.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

Every search query is recorded in wcf1_search_keyword via SearchKeywordAction::registerSearch(). It is called from SearchHandler::saveKeywordSuggestion() and the searches counter goes up by one each time. The data is used for
the keyword suggestions in the search (SearchKeywordAction::getSearchResultList(), ordered by searches DESC).

Nothing limits who can register a keyword or how often, so the suggestions are easy to manipulate:

  • Guests can submit any number of searches without authentication, for example from a script, and push arbitrary terms (spam, offensive content, advertising) to the top of the suggestions shown to everyone.
  • A single registered user can raise a keyword's counter without limit just by repeating the same search.

The daily cleanup in DailyCleanUpCronjob only removes rarely used keywords and does nothing against inflated counters.

Proposed solution

  1. Do not record keywords for guests. registerSearch() should not be called at all for guests. Searches by guests still work as before, they just no longer affect the suggestions.
  2. Count each keyword only once per user. A user's repeated searches for the same keyword must not raise searches again. This needs a way to track which user has already searched for which keyword.
Lingua principale
PHP
Stelle
248
Fork
147
Merge medio
17m
PR unite (30g)
21

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WoltLab/WCF

Tutte le issue di WoltLab/WCF

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.