Query parameters are parsed by hand or left untyped
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
- Lĩnh vực
- backend-api-design, databases, testing
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ả
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:
BaseChannelFilter.filter_licensescallsint()on each value.?licenses=abcraisesValueErroron/api/catalog(anonymous),/api/channeland/api/admin-channels.- The search viewset calls
int()infilter_licensesand uses an uncheckedre.searchinfilter_created_after. On/api/search/search,?licenses=abcraisesValueError,?created_after=abcraisesAttributeError, and?created_after=0000-01-01raisesValueError: year 0 is out of range. - The admin user list builds a Postgres regex from
keywords. On/api/admin-usersand itsdownload_csvaction,?keywords=(,a[or*raisesDataError: invalid regular expression. Related: #2920. - The public v2 contentnode filter lists
content_id,channel_id,prerequisite_for,relatedandhas_prerequisitewithout declaring a filter for them, so django-filter generates aCharFilter. On/api/public/v2/contentnode/,?content_id=abcraisesValueError: badly formed hexadecimal UUID string, and so do the other four. Related: #4788. - On the same endpoint,
resource_typesraisesKeyError: 'resource_types'for every value, becausecontentnode_metadata_lookuphas noresource_typesentry. Related: learningequality/kolibri#15797. - On the same endpoint,
exclude_content_idsraisesAttributeErrorfor every value, because the queryset has noexclude_by_content_idsmethod. - The public v1 views pass
keywordandtokens, the lookupidentifierand thechannel_idof/api/public/channel/<id>to the ORM unvalidated. A NUL byte (%00) in any of them raisesValueError: A string literal cannot contain NUL (0x00) characters. ChannelUserViewSet.remove_selfpasses itschannel_idquery param toChannel.objects.get. A malformed id returns 404, but one containing a NUL byte raises the sameValueError. #5968 fixed this onunstableby parsing the id withuuid.UUID().
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_typesandexclude_content_idsshould filter the results, as they do in Kolibri.- Admin
keywordsshould match regex metacharacters as literal text.
Acceptance Criteria
General
- Every input in Context other than valid
resource_typesandexclude_content_idsvalues returns 400 instead of 500. - A valid
resource_typesvalue returns only nodes with all of those resource types, andexclude_content_idsleaves out nodes with those content ids. -
?keywords=a[on/api/admin-usersreturns users whose name, email or channel matches the literal texta[.
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
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của learningequality/studio
-
Community library status changes don't update `date_updated`Có thể đã có người làm @ArpitaSamanta10 đã nhận hôm nay. Đang mởcommunity-contribution-in-progress DEV: backend good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
learningequality/studio#6414 · 8 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
learningequality/studio#6410 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
learningequality/studio#6409 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DEV: backend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
learningequality/studio#6407 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Stripe webhook accepts events when no webhook secret is configuredCó thể đã có người làm @adibmbrk đã nhận hôm nay. Đang mởcommunity-contribution-in-progress DEV: backend good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
learningequality/studio#6404 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của learningequality/studio
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
readthedocs/readthedocs-builder#73 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: ci bug good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
hffgzktbcc-blip/ounce-core#484 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
vllm-project/vllm-torchtpu#3395 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hermes plugin: MITM-domain discovery misses the model: block (provider/base_url nested under model:) — traffic blind-tunnels silently, zero compressionCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
ranxianglei/billion-context#7063 ·
Maintainer thường phản hồi trong vòng 1 ngày