Account and settings views crash on malformed request bodies
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 56/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- api, authentication, backend
Rechercherichtung
Start with the listed view entry points in contentcuration/views/users.py, settings.py, admin.py, and base.py, then read the serializer strategy in issue #6387 and the related forms in contentcuration/forms.py. Add regression coverage for each listed malformed input and confirm each returns 400 naming the invalid or missing field. Verify that well formed requests keep their existing status codes and response bodies.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
The account and settings views parse the request body with json.loads(request.body) and read fields by key without checking the body's shape. A body that isn't valid JSON, isn't a JSON object, is missing a field, or has a field of the wrong type raises an exception, and the request returns 500. Most of these views are reachable without logging in: login, registration, password reset and request activation link.
Complexity: Medium
Target branch: hotfixes
Context
All sites below fail with the inputs shown, and each input was reproduced:
login: body{,[1], missingusername,{"username": 5}.UserRegistrationView: body{or[1]. Its form parsespolicieswithjson.loads, so"policies": "{"also fails.UserPasswordResetViewandUserPasswordResetConfirmView: body{or[1].request_activation_link: body{, missingemail.PostFormMixin.post, used by change password, update full name, issues, request storage, delete account and policies update: body{or[1].PolicyAcceptFormalso fails on apolicyof"{","[1]"or"\"x\"".send_custom_email: body{, or{}, which re-raises theKeyErrorasObjectDoesNotExist.set_language: body{,[],{"next": 5},{"language": 5}.
The Change
- Each view in Context should validate its request body with a DRF serializer, following the strategy in #6387, and return 400 for any malformed body.
- Well-formed requests should keep their current status codes and response bodies, because the frontend depends on them.
Acceptance Criteria
General
- Every input listed in Context returns 400 instead of 500.
- Each 400 response names the invalid or missing field.
- Well-formed requests to each view return the same status code and body as before.
Testing
- Each view has a regression test that sends a malformed body and asserts 400.
AI usage
I scoped the audit and chose the validation strategy in #6387. Claude Code found and reproduced these failures and drafted this issue.
- Vorherrschende Sprache
- Python
- Sterne
- 212
- Forks
- 321
- Ø Merge
- 1 T. 7 Std.
- Gemergte PRs (30 T.)
- 14
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus learningequality/studio
-
Community library status changes don't update `date_updated`Evtl. vergeben @ArpitaSamanta10 hat das heute übernommen. Offencommunity-contribution-in-progress DEV: backend good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
learningequality/studio#6414 · 8 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
learningequality/studio#6410 ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
learningequality/studio#6409 ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
learningequality/studio#6407 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Stripe webhook accepts events when no webhook secret is configuredEvtl. vergeben @adibmbrk hat das heute übernommen. Offencommunity-contribution-in-progress DEV: backend good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
learningequality/studio#6404 · 3 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in learningequality/studio
Ähnliche Issues
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 76/100
samuelclay/NewsBlur#2214 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
MODEL_NOT_FOUND gives no suggestion for a model listed only as model:profileEvtl. vergeben @ShaiShmuel hat das heute übernommen. Offenenhancement rust
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
superlinked/sie#985 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
readthedocs/readthedocs-builder#73 ·
Maintainer antworten meist innerhalb von 1 Tag