`rb/unsafe-deserialization`: YAML.load - false positive since Psych 4.0
- Ngôn ngữ chính
- CodeQL
- Star
- 10.1k
- Fork
- 2.1k
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 141
Mô tả
**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`
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.