Query parameters are parsed by hand or left untyped

Đang mở
#6,392 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
57/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
django, postgresql, python

Hướng nghiên cứu

Start by reading the validation strategy in #6387 and inspect the referenced filters and views in contentcuration/viewsets/channel.py, search/viewsets/contentnode.py, contentcuration/viewsets/user.py, kolibri_public/views.py, and kolibri_public/views_v1.py. Add regression tests for each listed input, checking that invalid values return 400 and valid resource_types, exclude_content_ids, and literal regex keywords produce the specified results.

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

Mô tả

DEV: backend

Overview

Several list endpoints parse query parameters by hand, or let django-filter generate an untyped filter, so a value of the wrong type reaches Python or the database and the request returns 500. Most of these endpoints are public or reachable by any logged-in user.

Complexity: Medium
Target branch: hotfixes

Context

All inputs below were reproduced:

The Change
  • Each parameter in Context should be a typed django-filter filter, or validated by a DRF field in the v1 views, following the strategy in #6387, so an invalid value returns 400.
  • resource_types and exclude_content_ids should filter the results, as they do in Kolibri.
  • Admin keywords should match regex metacharacters as literal text.
Acceptance Criteria
General
  • Every input in Context other than valid resource_types and exclude_content_ids values returns 400 instead of 500.
  • A valid resource_types value returns only nodes with all of those resource types, and exclude_content_ids leaves out nodes with those content ids.
  • ?keywords=a[ on /api/admin-users returns users whose name, email or channel matches the literal text a[.
Testing
  • Each input in Context has a regression test.

AI usage

I scoped the audit and chose the validation strategy in #6387. Claude Code found and reproduced these failures and drafted this issue.

Ngôn ngữ chính
Python
Star
212
Fork
321
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
14

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

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 learningequality/studio

Tất cả issue của learningequality/studio

Issue tương tự

Thêm issue về Python

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.