Organization endpoints don't validate their request bodies

Aperta
#6,396 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
django, python
Ambito
api, backend, testing

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
214
Fork
327
Merge medio
17h 5m
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di learningequality/studio

Tutte le issue di learningequality/studio

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.