Organization endpoints don't validate their request bodies
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 76/100
Research direction
Read contentcuration/contentcuration/viewsets/channel.py around ChannelViewSet.organization_migration and contentcuration/contentcuration/views/users.py around send_organization_invitation_email, then review the serializer strategy in issue #6387. Add regression tests for a non-object JSON body and an unsupported organization share_mode; done means both endpoints return 400 for invalid bodies, and invalid invitations are not created.
Written by the indexing model from the issue text.
Description
Overview
The organization endpoints on unstable don't validate their request bodies. A malformed body returns 500, and an organization invitation can be sent with any share_mode, which then fails with a 500 when the invitee accepts.
Complexity: Low
Target branch: unstable
Context
Both inputs below were reproduced:
ChannelViewSet.organization_migrationcallsrequest.data.get. A JSON body of[1]raisesAttributeError: 'list' object has no attribute 'get'. Needs channel edit access.send_organization_invitation_emailreadsrequest.databy key, likesend_invitation_email(#6389), and stores anyshare_mode. An organization admin can sendshare_mode: "bogus"and get 200. When the invitee accepts,Invitation.acceptcalls_accept_organization_invitation, which raises DjangoValidationError: Invalid share_mode: bogus.
The Change
- Both views should validate their bodies with DRF serializers, following the strategy in #6387.
send_organization_invitation_emailshould accept only the share modes_accept_organization_invitationhandles for organizations:VIEW_ACCESS,EDIT_ACCESSandADMIN_ACCESS.
Acceptance Criteria
General
-
organization_migrationreturns 400 for a body that isn't a JSON object. -
send_organization_invitation_emailreturns 400 and creates no invitation for ashare_modeoutsideVIEW_ACCESS,EDIT_ACCESSandADMIN_ACCESS, or a malformed body.
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.
- 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