Query parameters are parsed by hand or left untyped

Abierto
#6,392 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
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
57/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
django, postgresql, python

Línea de trabajo

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.

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

Descripción

DEV: backend

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:

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_types and exclude_content_ids should filter the results, as they do in Kolibri.
  • Admin keywords should match regex metacharacters as literal text.
Acceptance Criteria
General
  • Every input in Context other than valid resource_types and exclude_content_ids values returns 400 instead of 500.
  • A valid resource_types value returns only nodes with all of those resource types, and exclude_content_ids leaves out nodes with those content ids.
  • ?keywords=a[ on /api/admin-users returns users whose name, email or channel matches the literal text a[.
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
Python
Estrellas
212
Forks
321
Merge medio
1 d 7 h
PR fusionados (30 d)
14

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 Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.