### 漏洞概述 - **CVE编号**: CVE-2020-2297 - **描述**: 该漏洞涉及 `SourcelessFileLoader` 在使用 `io.open_code` 时的问题。 ### 影响范围 - **受影响模块**: `Lib/importlib/_bootstrap_external.py` - **具体函数**: `get_data` 和 `get_filename` ### 修复方案 - **修复内容**: 确保 `SourcelessFileLoader` 使用 `io.open_code`。 - **相关文件**: - `Lib/importlib/_bootstrap_external.py` - `Misc/NEWS.d/next/Security/2020-03-04-18-59-17.gh-issue-145506.dhwEn.rst` ### 代码变更 ```python # Lib/importlib/_bootstrap_external.py def get_data(self, path): """Return the data from path as raw bytes.""" if isinstance(self, (SourceLoader, ExtensionFileLoader)): if isinstance(self, (SourceLoader, SourcelessFileLoader, ExtensionFileLoader)): with _io.open_code(str(path)) as file: return file.read() else: ... ``` ### 补充说明 - **提交者**: miss-islington 和 zooba - **提交时间**: 18小时前 - **关联问题**: GH-145506, GH-145507, GH-145515 ### 评论 - 无评论。