zipcontent returns 304 before checking the entry exists, and 500 for non-zip files
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
调研方向
从 contentcuration/contentcuration/views/zip.py 入手,重点查看 If-Modified-Since 检查、BadZipfile 处理器和 POSSIBLE_ZIPPED_FILE_EXTENSIONS。阅读 contentcuration/contentcuration/tests/test_zipcontentview.py 中的 test_invalid_zip,并补充对缺失条目和现有条目的条件请求的覆盖。完成标准:不存在的条目以及无效或不受支持的 zip 文件返回 404,且不会产生 Sentry 报告;现有条目返回 304 时包含与 200 响应相同的 CORS 标头。
由索引模型根据 Issue 内容生成。
描述
Overview
ZipContentView answers any request carrying an If-Modified-Since header with 304 before it checks the entry inside the zip exists. For a stored file that isn't a zip, it returns a deliberate 500 and reports it to Sentry on every request. Both are reachable anonymously.
Complexity: Low
Target branch: hotfixes
Context
All behaviour below was reproduced:
- The
If-Modified-Sincecheck runs before the lookup.If-Modified-Since: garbageon a nonexistent entry returns 304 instead of 404, and the 304 has none of the CORS headers the 200 carries. - The
BadZipfilehandler returnsHttpResponseServerErrorand callscapture_message./zipcontent/<checksum>.pdf/index.htmlreaches it.POSSIBLE_ZIPPED_FILE_EXTENSIONSis defined but never checked. test_invalid_zipincontentcuration/contentcuration/tests/test_zipcontentview.pyasserts the 500.- Related: #906, #844.
The Change
If-Modified-Sinceshould only produce a 304 for an entry that exists, and the 304 should carry the same CORS headers as the 200.- A request for a stored file whose extension isn't in
POSSIBLE_ZIPPED_FILE_EXTENSIONS, or that isn't a valid zip, should return 404 without a Sentry report.
Acceptance Criteria
General
- A request with any
If-Modified-Sincefor a nonexistent entry returns 404. - A request with
If-Modified-Sincefor an existing entry returns 304 with the same CORS headers as the 200. -
/zipcontent/<checksum>.pdf/index.htmlreturns 404 and sends nothing to Sentry.
Testing
-
test_invalid_zipasserts 404, and new tests cover the twoIf-Modified-Sincecases.
AI usage
I scoped the audit. 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 天内回复
-
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 天内回复
-
Contentnode `requisites` action skips the permission check可能已有人在做 @sreehari-vp 今天认领。 未关闭community-contribution-in-progress DEV: backend good first issue help wanted
难度 2/5 1-3 小时 新手友好度 78/100
learningequality/studio#6400 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 learningequality/studio 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
audit-reference-check
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
site-bug triage
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 77/100
canonical/paas-charm#407 · 1 条评论 ·
维护者通常 5 天内回复