Organization endpoints don't validate their request bodies

Aberta
#6,396 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
76/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
django, python
Domínio
api, backend, testing

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
JavaScript
Estrelas
214
Forks
327
Merge médio
17h 5min
PRs com merge (30d)
25

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de learningequality/studio

Todas as issues de learningequality/studio

Issues semelhantes

Mais issues de JavaScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.