github / github/codeql

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

オープン
#10,151 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
false-positive Ruby
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
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 を短くまとめたダイジェスト。