Prevent the manipulation of search keyword suggestions

Abierto
#6,769 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
php
Área
backend, search

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
PHP
Estrellas
248
Forks
147
Merge medio
17 min
PR fusionados (30 d)
21

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de WoltLab/WCF

Todos los issues de WoltLab/WCF

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.