python / python/cpython

SSLSocket.get_verified_chain() and get_unverified_chain() raise AttributeError after the TLS layer is torn down

未关闭
#155,327 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

stdlib topic-SSL type-bug
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Bug report

SSLSocket.get_verified_chain() and SSLSocket.get_unverified_chain() raise
AttributeError when called after the socket's TLS layer is torn down (for
example after unwrap()), while every other query method (cipher(),
version(), group(), ...) returns a value:

>>> s.unwrap()
>>> s.get_verified_chain()
Traceback (most recent call last):
  ...
AttributeError: 'NoneType' object has no attribute 'get_verified_chain'

The two methods access self._sslobj without the _checkClosed() /
if self._sslobj is None guard the sibling methods use. They were added in
gh-109113 (3.13), so 3.13 and later are affected.

CPython versions tested on:

3.16 (main)

Operating systems tested on:

Linux, macOS

Linked PRs
  • gh-155328

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 SSLSocket.get_verified_chain() 和 get_unverified_chain() 开始,然后将它们在 unwrap() 后对 self._sslobj 的处理方式与同类查询方法进行比较。当 TLS 层被拆除时这两个方法都不再引发 AttributeError,并且它们在该状态下的行为与其他查询方法一致,即为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
networking, security
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。