Organization endpoints don't validate their request bodies

オープン
#6,396 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
django, python
領域
api, backend, testing

調査の方向性

Read contentcuration/contentcuration/viewsets/channel.py around ChannelViewSet.organization_migration and contentcuration/contentcuration/views/users.py around send_organization_invitation_email, then review the serializer strategy in issue #6387. Add regression tests for a non-object JSON body and an unsupported organization share_mode; done means both endpoints return 400 for invalid bodies, and invalid invitations are not created.

索引モデルが issue の本文から書いたものです。

説明

DEV: backend

Overview

The organization endpoints on unstable don't validate their request bodies. A malformed body returns 500, and an organization invitation can be sent with any share_mode, which then fails with a 500 when the invitee accepts.

Complexity: Low
Target branch: unstable

Context

Both inputs below were reproduced:

The Change
  • Both views should validate their bodies with DRF serializers, following the strategy in #6387.
  • send_organization_invitation_email should accept only the share modes _accept_organization_invitation handles for organizations: VIEW_ACCESS, EDIT_ACCESS and ADMIN_ACCESS.
Acceptance Criteria
General
  • organization_migration returns 400 for a body that isn't a JSON object.
  • send_organization_invitation_email returns 400 and creates no invitation for a share_mode outside VIEW_ACCESS, EDIT_ACCESS and ADMIN_ACCESS, or a malformed body.
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.

主要言語
JavaScript
スター
214
フォーク
327
平均マージ
17時間 5分
マージ済み PR(30日)
25

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

learningequality/studio のほかの issue

learningequality/studio の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。