Account and settings views crash on malformed request bodies
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 56/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- api, authentication, backend
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
❌ 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.
- 主要语言
- Python
- 星标
- 212
- 派生
- 321
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 14
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
learningequality/studio 的其他 Issue
-
Community library status changes don't update `date_updated`可能已有人在做 @ArpitaSamanta10 今天认领。 未关闭community-contribution-in-progress DEV: backend good first issue help wanted
难度 2/5 1-3 小时 新手友好度 84/100
learningequality/studio#6414 · 8 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
DEV: backend
难度 2/5 1-3 小时 新手友好度 82/100
learningequality/studio#6410 ·
维护者通常 1 天内回复
-
DEV: backend
难度 2/5 1-3 小时 新手友好度 76/100
learningequality/studio#6409 ·
维护者通常 1 天内回复
-
DEV: backend
难度 2/5 1-3 小时 新手友好度 78/100
learningequality/studio#6407 ·
维护者通常 1 天内回复
-
Stripe webhook accepts events when no webhook secret is configured可能已有人在做 @adibmbrk 今天认领。 未关闭community-contribution-in-progress DEV: backend good first issue help wanted
难度 2/5 1-3 小时 新手友好度 78/100
learningequality/studio#6404 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 learningequality/studio 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 77/100
canonical/paas-charm#407 · 1 条评论 ·
维护者通常 5 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 90/100
FAIRmat-NFDI/pynxtools-spm#136 ·
维护者通常 1 天内回复
-
enhancement tooling
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
`read_nexus` entry point points to a function that no longer exists可能已有人在做 @RubelMozumder 今天认领。 未关闭annotator bug
难度 1/5 1 小时以内 新手友好度 88/100
FAIRmat-NFDI/pynxtools#876 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug]: HTTP 499 (Client Closed Request) is classified as a non-retryable format_error, so a mid-flight abort fails the turn over instead of retrying可能已有人在做 @yipinghuang1991 今天认领。 未关闭comp/agent P2 type/bug
难度 2/5 1-3 小时 新手友好度 82/100
NousResearch/hermes-agent#156837 ·
维护者通常 1 天内回复