Organization endpoints don't validate their request bodies

Abierto
#6,396 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
django, python
Área
api, backend, testing

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
JavaScript
Estrellas
214
Forks
327
Merge medio
17 h 5 min
PR fusionados (30 d)
25

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de learningequality/studio

Todos los issues de learningequality/studio

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.