github / github/codeql

False positive: Ruby: Kernel Open when File existence guard is present

未關閉
#16,943 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
false-positive
主要語言
CodeQL
星號
10.1k
分支
2.1k
平均合併
2 天 15 小時
30 天內合併 PR
141

描述

**Description of the false positive**

When `IO.read` is guarded by a check like `File.exists?`, isn't that a valid guard against injecting the `|` character into `Kernel.open`? I don't imagine that many systems out there have files lying around named `|.txt`.

**Code samples or links to source code**

https://github.com/github/codeql/blob/81593ece5aa7701ec0b103932f84ff65ae506e0b/ruby/ql/lib/codeql/ruby/security/KernelOpenQuery.qll#L83C1-L87

**URL to the alert on GitHub code scanning (optional)**
- https://github.com/Chainguard-Wolfi-Bites-Back/opensearch-project__logstash-output-opensearch/security/code-scanning/2
- https://github.com/opensearch-project/logstash-output-opensearch/blob/4221dffef4c1d9fd5ded5ae726ef2874fdd9ba5b/lib/logstash/outputs/opensearch/template_manager.rb#L55-L59

貢獻指南

開啟貢獻指南

研究方向

閱讀 ruby/ql/lib/codeql/ruby/security/KernelOpenQuery.qll 第 83-87 行附近的內容,並檢查 template_manager.rb 第 55-59 行附近連結的 Ruby 範例。判斷 File.exists? 守衛是否應抑制此 Kernel.open 警示,然後驗證查詢對回報模式及相關案例的行為。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
ruby
領域
security
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。