False positive: Full server-side request forgery
まだ誰も着手していません。
評価
調査の方向性
py/full-ssrf クエリから始め、request.url.replace と urllib.parse.urljoin を使って報告された Python の例を再現します。それらのアラートを、受け入れられた文字列連結の例と比較し、その後、有効な URL 構築の緩和策が認識され、実際の SSRF 検出結果が抑制されないことを確認します。
索引モデルが issue の本文から書いたものです。
説明
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:
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:
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:
url = "my-expected-host-url" + request.path
Having to use string concatenation instead of urljoin is not ideal.
- 主要言語
- CodeQL
- スター
- 10.1k
- フォーク
- 2.1k
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 143
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/codeql のほかの issue
-
agentic-workflows
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
false-positive javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
false-positive
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
punkpeye/mcp-remote#369 ·
-
Mend: dependency security vulnerability untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
cisagov/vulnrichment#337 ·
-
bug DUP Reservations
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
bcgov/reserve-rec-public#896 ·