Account and settings views crash on malformed request bodies
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 56/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- api, authentication, backend
Research direction
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.
Written by the indexing model from the issue text.
Description
❌ 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.
- Dominant language
- JavaScript
- Stars
- 214
- Forks
- 327
- Avg merge
- 17h 5m
- Merged PRs (30d)
- 25
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from learningequality/studio
-
Community library status changes don't update `date_updated`Possibly taken @ArpitaSamanta10 claimed this 14 days ago. Opencommunity-contribution-in-progress DEV: backend good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
learningequality/studio#6414 · 8 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Activation key can activate a different account whose email differs only in casePossibly taken @Madhu-priya123 claimed this 5 days ago. OpenDEV: backend
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
learningequality/studio#6410 · 2 comments ·
Maintainers usually reply within 1 day
-
DEV: backend
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
learningequality/studio#6409 ·
Maintainers usually reply within 1 day
-
DEV: backend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
learningequality/studio#6407 ·
Maintainers usually reply within 1 day
-
Stripe webhook accepts events when no webhook secret is configuredPossibly taken @adibmbrk claimed this 14 days ago. Opencommunity-contribution-in-progress DEV: backend good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
learningequality/studio#6404 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in learningequality/studio
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
babalae/bettergi-scripts-list#3905 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] "Configure Colota" opens Colota with "Invalid configuration: No configuration data in URL"Open
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
dedicatedcode/reitti#1445 ·
Maintainers usually reply within 1 day
-
New tool: Uncle DeskPossibly taken @github-actions claimed this today. Opensubmission triage
Difficulty 1/5 Under an hour Newbie friendliness 85/100
kausalflow/tools#384 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
area: css
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day