Make Add-On scratch a multi-part upload
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
- 55/100
Línea de trabajo
Start with documentcloud/addons/serializers.py and the AddOnEventSerializer, then inspect the AddOn.store_event_data() implementation in python-documentcloud. Add ScratchField and tests for a multipart PATCH over 2.5 MB and a normal JSON PATCH; update the client to send scratch as a file part and release a new version. Done means both PATCH cases work within the nginx upload limit.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Issue
Something broke during the DocumentCloud dependency update today and it's really only been working coincidentally in some cases. store_event_data which calls a PATCH to /api/addon_events/pk with a JSON blob previously was working without a limit.
This is why I started working on enforcing a limit via nginx in this PR:
https://github.com/MuckRock/documentcloud/pull/496
It turns out Django does have a native limit which is DATA_UPLOAD_MAX_MEMORY_SIZE. This is set to 2.5MB by default. This wasn't evaluated correctly in older versions of django-rest-framework for JSON blobs and was the subject of a CVE here:
https://fieldguide.lutrasecurity.com/CVE-2026-73228/
This was patched in our most recent update of django-rest-framework, which was a minor revision bump.
We do currently use scratch > 2.5MB on some Add-Ons and I initially thought up to 25MB would be ok, since it's just there for the occasional store and load call.
Resolution
Since scratch is already deferred and only loaded in the detail view, keeping it in Postgres is fine. To restore support for scratch over 2.5 MB, we can send it as a multipart file upload instead of a JSON body. The nginx 25MB will be the limit that caps this.
In app:
- Add ScratchField to documentcloud/addons/serializers.py and declare scratch = ScratchField(required=False, help_text=_("Field to store data for add-on between events")) on AddOnEventSerializer.
- Add tests for a multipart file PATCH over 2.5 MB and a normal JSON PATCH.
No parser changes are needed, because the default parsers already include MultiPartParser.
In python-documentcloud:
- Change AddOn.store_event_data() to send scratch as a real file part with a filename, for example files={"scratch": ("scratch.json", json.dumps(data), "application/json")}. A plain form field still counts against the limit.
- Release a new version.
- Lenguaje dominante
- Python
- Estrellas
- 55
- Forks
- 10
- Merge medio
- 1 d 13 h
- PR fusionados (30 d)
- 22
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 MuckRock/documentcloud
-
Remove cpuprofile dependencyAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
MuckRock/documentcloud#537 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 50/100
MuckRock/documentcloud#539 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
MuckRock/documentcloud#534 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
MuckRock/documentcloud#531 ·
Los mantenedores suelen responder en 1 día
-
processing
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
MuckRock/documentcloud#509 ·
Los mantenedores suelen responder en 1 día
Todos los issues de MuckRock/documentcloud
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
comp/desktop P3 type/feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
NousResearch/hermes-agent#154285 ·
Los mantenedores suelen responder en 1 día
-
docs: qualify copied and custom kubectl debug policy notesPosiblemente ocupada @nym01 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
kubescape/cel-admission-library#166 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
SACGF/variantgrid#2804 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[BUG] HTTP lifecycle dispatch treats a NO_PROXY-only environment as corporate egress and skips the resolve-and-pinned sessionPosiblemente ocupada @bodapatisaikrishna la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día