Query parameters are parsed by hand or left untyped
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
- Área
- backend-api-design, databases, testing
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
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:
BaseChannelFilter.filter_licensescallsint()on each value.?licenses=abcraisesValueErroron/api/catalog(anonymous),/api/channeland/api/admin-channels.- The search viewset calls
int()infilter_licensesand uses an uncheckedre.searchinfilter_created_after. On/api/search/search,?licenses=abcraisesValueError,?created_after=abcraisesAttributeError, and?created_after=0000-01-01raisesValueError: year 0 is out of range. - The admin user list builds a Postgres regex from
keywords. On/api/admin-usersand itsdownload_csvaction,?keywords=(,a[or*raisesDataError: invalid regular expression. Related: #2920. - The public v2 contentnode filter lists
content_id,channel_id,prerequisite_for,relatedandhas_prerequisitewithout declaring a filter for them, so django-filter generates aCharFilter. On/api/public/v2/contentnode/,?content_id=abcraisesValueError: badly formed hexadecimal UUID string, and so do the other four. Related: #4788. - On the same endpoint,
resource_typesraisesKeyError: 'resource_types'for every value, becausecontentnode_metadata_lookuphas noresource_typesentry. Related: learningequality/kolibri#15797. - On the same endpoint,
exclude_content_idsraisesAttributeErrorfor every value, because the queryset has noexclude_by_content_idsmethod. - The public v1 views pass
keywordandtokens, the lookupidentifierand thechannel_idof/api/public/channel/<id>to the ORM unvalidated. A NUL byte (%00) in any of them raisesValueError: A string literal cannot contain NUL (0x00) characters. ChannelUserViewSet.remove_selfpasses itschannel_idquery param toChannel.objects.get. A malformed id returns 404, but one containing a NUL byte raises the sameValueError. #5968 fixed this onunstableby parsing the id withuuid.UUID().
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_typesandexclude_content_idsshould filter the results, as they do in Kolibri.- Admin
keywordsshould match regex metacharacters as literal text.
Acceptance Criteria
General
- Every input in Context other than valid
resource_typesandexclude_content_idsvalues returns 400 instead of 500. - A valid
resource_typesvalue returns only nodes with all of those resource types, andexclude_content_idsleaves out nodes with those content ids. -
?keywords=a[on/api/admin-usersreturns users whose name, email or channel matches the literal texta[.
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
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de learningequality/studio
-
Community library status changes don't update `date_updated`Posiblemente ocupada @ArpitaSamanta10 la tomó hoy. Abiertocommunity-contribution-in-progress DEV: backend good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
learningequality/studio#6414 · 8 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
DEV: backend
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
learningequality/studio#6410 ·
Los mantenedores suelen responder en 1 día
-
DEV: backend
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
learningequality/studio#6409 ·
Los mantenedores suelen responder en 1 día
-
DEV: backend
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
learningequality/studio#6407 ·
Los mantenedores suelen responder en 1 día
-
Stripe webhook accepts events when no webhook secret is configuredPosiblemente ocupada @adibmbrk la tomó hoy. Abiertocommunity-contribution-in-progress DEV: backend good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
learningequality/studio#6404 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de learningequality/studio
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
Reference check: findingsAbiertoaudit-reference-check
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
screenrec.com stopped workingAbiertosite-bug triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
canonical/paas-charm#407 · 1 comentario ·
Los mantenedores suelen responder en 5 días