False positive: Full server-side request forgery
- 主要语言
- CodeQL
- 星标
- 10.1k
- 派生
- 2.1k
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 141
描述
**Description of the false positive**
I have seen alerts for "Full server-side request forgery" (id: `py/full-ssrf`), even though the code has a valid mitigation in place. CodeQL also isn't recognizing other valid mitigations for this vulnerability.
For example, given this code:
```python
url = request.url.replace(request.host_url, "my-expected-host-url")
resp = requests.request(
url=url,
)
```
As you can see, this code is already using `request.url.replace` to control the requested URL and ensure that malicious requests cannot manipulate the destination of the request. However, CodeQL does not recognize this method as a valid mitigation for SSRF.
I also tried:
```python
from urllib.parse import urljoin
url = urljoin("my-expected-host-url", request.path)
```
CodeQL does not accept this approach either.
The only approach that CodeQL accepts is string concatenation:
```python
url = "my-expected-host-url" + request.path
```
Having to use string concatenation instead of `urljoin` is not ideal.
贡献指南
调研方向
Start with the py/full-ssrf query and reproduce the reported Python examples using request.url.replace and urllib.parse.urljoin. Compare their alerts with the accepted string-concatenation example, then verify that valid URL-construction mitigations are recognized without suppressing real SSRF findings.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- security
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100