Query parameters are parsed by hand or left untyped
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 57/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 212
- フォーク
- 321
- 平均マージ
- 1日 7時間
- マージ済み PR(30日)
- 14
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
learningequality/studio のほかの issue
-
Community library status changes don't update `date_updated`対応中かも @ArpitaSamanta10 が今日担当しました。 オープンcommunity-contribution-in-progress DEV: backend good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
learningequality/studio#6414 · コメント 8 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
DEV: backend
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
learningequality/studio#6410 ·
メンテナーはふだん 1 日以内に返信
-
DEV: backend
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
learningequality/studio#6409 ·
メンテナーはふだん 1 日以内に返信
-
DEV: backend
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
learningequality/studio#6407 ·
メンテナーはふだん 1 日以内に返信
-
Stripe webhook accepts events when no webhook secret is configured対応中かも @adibmbrk が今日担当しました。 オープンcommunity-contribution-in-progress DEV: backend good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
learningequality/studio#6404 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
learningequality/studio の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
audit-reference-check
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
site-bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
canonical/paas-charm#407 · コメント 1 件 ·
メンテナーはふだん 5 日以内に返信