github / github/codeql

`rb/unsafe-deserialization`: YAML.load - false positive since Psych 4.0

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

描述

**Description of the false positive**

Good news: `YAML.load` got safer :wink:

Since [Psych 4.0](https://www.ctrl.blog/entry/ruby-psych4.html) no arbitrary Ruby classes are instantiated when `YAML.load` is used. There's now a method called `YAML.unsafe_load` to get the old behavior back.
This change in behavior affects the `rb/unsafe-deserialization` query.

Sidenote:
Ruby 3.1 (released in December 2021) depends on Psych 4.0 by default. (Projects still can use older Psych versions by defining something like `psych ~>3.0` in their Gemfiles.)

Following ideas:
* Add a note to unsafe deserialization results that concern `YAML.load`. E.g., "YAML.load is insecure in Psych versions before 4.0"
* Add a source for `YAML.unsafe_load`

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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