cpu_profiler未对URL参数做编码转义,潜在跨站脚本风险
- Dominant language
- C++
- Stars
- 17.6k
- Forks
- 4.1k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 69
Description
**Describe the bug (描述bug)**
输入点:/src/brpc/builtin/hotspots_service.cpp#L628
```
const std::string* view = cntl->http_request().uri().GetQuery("view");
```
输出点,拼接输出到标签之间:/src/brpc/builtin/hotspots_service.cpp#L994
```
if (view) {
os << "&view=" << *view;
}
```
**To Reproduce (复现方法)**
https://brpc_site/hotspots/cpu?view=?"><iframe>
IE浏览器下,地址栏未对<、>、"做URL编码,产生跨站脚本风险

Contributor guide
Research direction
Read /src/brpc/builtin/hotspots_service.cpp around lines 628 and 994 to follow the view query parameter from input to the generated script output. Reproduce the reported /hotspots/cpu URL in IE or an equivalent browser, then verify that characters supplied through view are safely handled and the example no longer creates executable markup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100