-
fix(CVE-2024-39705): remove nltk download (#3361)
发布于
2024-07-08 22:55:36 +00:00 Summary
Addresses
CVE-2024-39705, which
highlights the risk of remote code execution when running
nltk.download. Removesnltk.downloadin favor of a.tgzfile with
the appropriate NLTK data files and checking the SHA256 hash to validate
the download. An error now raises ifnltk.downloadis invoked.The logic for determining the NLTK download directory is borrowed from
nltk, so users can still setNLTK_DATAas they did previously.Testing
- Create a directory called
~/tmp/nltk_test. Set
NLTK_DATA=${HOME}/tmp/nltk_test. - From a python interactive session, run:
from unstructured.nlp.tokenize import download_nltk_packages download_nltk_packages()- Run
ls /tmp/nltk_test/nltk_data. You should see the downloaded
data.
Co-authored-by: Steve Canny stcanny@gmail.com
下载附件
- Create a directory called