Prevent the manipulation of search keyword suggestions

Đang mở
#6,769 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
backend, search

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
PHP
Star
248
Fork
147
Merge trung bình
17 phút
Pull request đã merge (30 ngày)
21

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của WoltLab/WCF

Tất cả issue của WoltLab/WCF

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.