Scanner probes cause MimeNegotiation::InvalidType 500s on the home page: return 4xx instead
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
先阅读 app/controllers/application_controller.rb 中现有的 unsupported_media_type 处理程序,然后检查 config/application.rb 中如何设置 config.action_dispatch.rescue_responses。为带有格式错误的 Accept 标头的 GET / 添加一个 request spec,并确认它返回 4xx 响应。spec 通过且无效 MIME 类型不再导致 500 时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Problem
Scout APM Errors (7 days to 2026-11-15): ActionDispatch::Http::MimeNegotiation::InvalidType on StaticController#index (the home page). 4 all-time, 1 in the last 7 days, latest 2026-11-10. The message is a path-traversal probe: "../../../../../../../../../../etc/services{{" is not a valid MIME type.
Root cause
This is an automated scanner sending a junk Accept or Content-Type header. Rails raises while reading request.format and returns a 500, which pages us and fills the error list with noise. It is not a vulnerability: Rails rejects the value. It should be a 4xx, not an error.
Suggested fix
- In
ApplicationController, addrescue_from ActionDispatch::Http::MimeNegotiation::InvalidTypewith a handler that doeshead :not_acceptable(406) orhead :bad_request(400). Look at the existingunsupported_media_typehandler inapp/controllers/application_controller.rbfirst; it may be reusable. - Note the exception can be raised before the controller runs (in middleware). If a controller
rescue_fromdoes not catch it in a spec, add the handler as a small Rack middleware or useconfig.action_dispatch.rescue_responses["ActionDispatch::Http::MimeNegotiation::InvalidType"] = :not_acceptableinconfig/application.rb. That one line is the simplest option, try it first. - Add a request spec:
get "/", headers: {"Accept" => "../../etc/passwd{{"}returns 4xx, not 500. - Mark Scout error group 124280 resolved after deploy.
Difficulty: easy. Good first issue.
- 主要语言
- Ruby
- 星标
- 384
- 派生
- 558
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 63
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rubyforgood/casa 的其他 Issue
-
Difficulty: Easy Good First Issue Help Wanted ruby Type: Bug
难度 2/5 1-3 小时 新手友好度 76/100
rubyforgood/casa#7402 ·
维护者通常 1 天内回复
-
Remove the bin/bundle binstub (Heroku warns it can break Bundler on deploy)可能已有人在做 @Akash-Dhanwate 于 8 天前认领。 未关闭dependencies Difficulty: Easy Good First Issue
难度 1/5 1 小时以内 新手友好度 82/100
rubyforgood/casa#7325 · 2 条评论 ·
维护者通常 1 天内回复
-
Reports page: move export-button disable/re-enable into a Stimulus controller可能重新可做 @Akash-Dhanwate 于 9 天前认领,目前没有进行中的 PR。 未关闭Difficulty: Easy Good First Issue Help Wanted javascript
难度 2/5 1-3 小时 新手友好度 72/100
rubyforgood/casa#7311 · 2 条评论 ·
维护者通常 1 天内回复
-
New case: use Stimulus for the "I don't know the court date yet" toggle可能重新可做 @Aryankn29 于 9 天前认领,目前没有进行中的 PR。 未关闭Difficulty: Easy Good First Issue Help Wanted javascript
难度 2/5 1-3 小时 新手友好度 78/100
rubyforgood/casa#7310 · 1 条评论 ·
维护者通常 1 天内回复
-
Case contacts filter: use the auto-submit Stimulus controller instead of jQuery可能已有人在做 @Impana-14 于 7 天前认领。 未关闭Difficulty: Easy Good First Issue Help Wanted javascript
难度 2/5 1-3 小时 新手友好度 78/100
rubyforgood/casa#7309 · 2 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 66/100
internetee/registry#2984 ·
维护者通常 6 天内回复
-
Redis Lua error `@user_script:52: ERR value is not an integer or out of range` when `window_size` is configured可能已有人在做 @mimosa 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
riscv/riscv-unified-db#2829 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
docker-library/ruby#534 ·
-
难度 2/5 1-3 小时 新手友好度 68/100