pySCG: Avoid pickle in most cases or at least warn

オープン
#4 コメント 18 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
54/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python

調査の方向性

Start by finding the guide section that discusses pickle and compare its guidance with the linked Python documentation and the issue’s examples of safer alternatives. Add a clear warning about unpickling untrusted data and list practical alternatives or protections; done when readers can identify the risk and see safer options. The issue does not name a specific file or test.

索引モデルが issue の本文から書いたものです。

説明

The Python3 pickle documentation says the following:

The pickle module is not secure. Only unpickle data you trust. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling. Never unpickle data that could have come from an untrusted source, or that could have been tampered with. Consider signing data with hmac if you need to ensure that it has not been tampered with. Safer serialization formats such as json may be more appropriate if you are processing untrusted data. See Comparison with json.

However, many researchers and developers are quite clueless about the problem. Paws in the Pickle Jar: Risk & Vulnerability in the Model-sharing Ecosystem reports that, "Our analysis shows that more than 80% of the evaluated machine learning models in the ecosystem consist of pickle-serialized code, which is vulnerable to code injection / arbitrary code execution risks... The pickle module serializes the underlying source code into a byte stream that can’t be statically interpreted back to its true intention and functionality. This requires the user to implicitly trust the contents of the model file uploaded by the author. For this reason, HuggingFace encourages safe tensors as a replacement for PyTorch models, and Splunk supports import of ONNX-formatted models".

Providing a clear note about the problem, and listing several solutions, would be a big help.

主要言語
Python
スター
2
フォーク
2
平均マージ
11分
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ossf/python-secure-coding-guide のほかの issue

ossf/python-secure-coding-guide の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。