Invitation, recommendation and Stripe webhook endpoints crash on malformed input
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Start with the three named entry points: contentcuration/contentcuration/views/users.py (send_invitation_email), contentcuration/contentcuration/viewsets/recommendation.py (RecommendationView.post), and contentcuration/contentcuration/views/subscription.py (stripe_webhook and its serializers). Follow the validation strategy in issue #6387 and add regression tests for every reproduced input listed here. Done means malformed invitation and recommendation requests return 400, while the two invalid Stripe events return 200 without changing the subscription.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Overview
send_invitation_email and RecommendationView read request.data by key without a serializer, and the Stripe webhook's serializers accept two payload shapes that then crash. A body of the wrong shape, or a field of the wrong type, length or value, raises an exception and the request returns 500.
Complexity: Medium
Target branch: hotfixes
Context
All sites below fail with the inputs shown, and each input was reproduced:
send_invitation_email: a JSON list body,user_email: 5, a 120-character email, a 60-charactershare_mode, auser_emailcontaining a newline (BadHeaderError), and a nonexistentchannel_id(DoesNotExist, raised before the permission check). It also storesnot an emailas an invitation, and anyshare_modeother thanVIEW_ACCESSgrants edit access on accept.RecommendationView.post: a JSON list body, a JSON string body, or a form-encoded body.request.data.popruns before the schema check.stripe_webhook, after the signature check passes: acustomer.subscription.updatedevent with statusactiveand emptyitems.dataraisesIndexErrorinsave. Acurrent_period_endof10**15raisesValueErrorinTimestampField.to_internal_value, whichis_validdoesn't catch. Stripe retries a webhook that returns 500.
The Change
send_invitation_emailandRecommendationViewshould validate their bodies with DRF serializers, following the strategy in #6387, and return 400 for malformed input.send_invitation_emailshould accept only a valid email address and ashare_modeofEDIT_ACCESSorVIEW_ACCESS.stripe_webhookshould handle these payloads like any other event its serializer rejects: log a warning and return 200 without changing the subscription.
Acceptance Criteria
General
- Every input listed in Context for
send_invitation_emailandRecommendationViewreturns 400 instead of 500. -
send_invitation_emailreturns 400 and creates no invitation for an invalid email address or ashare_modeother thanEDIT_ACCESSorVIEW_ACCESS. - The two Stripe payloads in Context return 200 and leave the user's subscription unchanged.
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.
- Lingua principale
- JavaScript
- Stelle
- 214
- Fork
- 327
- Merge medio
- 17h 5m
- PR unite (30g)
- 25
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di learningequality/studio
-
Community library status changes don't update `date_updated`Forse già presa @ArpitaSamanta10 l’ha presa 14 giorni fa. Apertacommunity-contribution-in-progress DEV: backend good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
learningequality/studio#6414 · 8 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Activation key can activate a different account whose email differs only in caseForse già presa @Madhu-priya123 l’ha presa 5 giorni fa. ApertaDEV: backend
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
learningequality/studio#6410 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
DEV: backend
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
learningequality/studio#6409 ·
I maintainer di solito rispondono entro 1 giorno
-
DEV: backend
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
learningequality/studio#6407 ·
I maintainer di solito rispondono entro 1 giorno
-
Stripe webhook accepts events when no webhook secret is configuredForse già presa @adibmbrk l’ha presa 14 giorni fa. Apertacommunity-contribution-in-progress DEV: backend good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
learningequality/studio#6404 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di learningequality/studio
Issue simili
-
[bug] 提瓦特记事本原石检测框宽度较窄Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
babalae/bettergi-scripts-list#3905 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] "Configure Colota" opens Colota with "Invalid configuration: No configuration data in URL"Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 87/100
dedicatedcode/reitti#1445 ·
I maintainer di solito rispondono entro 1 giorno
-
New tool: Uncle DeskForse già presa @github-actions l’ha presa oggi. Apertasubmission triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
kausalflow/tools#384 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
-
Fuzz: css syntax bug foundApertaarea: css
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno