Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Unpacking search (SearchIter) fails with PK data from Nexus Personal

未关闭
#192 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
security

调研方向

Reproduce the failure with the shown SearchIter usage and inspect pkcs11/_utils.pyx:_unpack_attributes, pkcs11/_pkcs11.pyx:Object.getitem, and SearchIter.next. Determine how the Nexus Personal PKCS11 data reaches the boolean unpacking path, then verify that list(q) completes without the reported struct.error or cleanup exception.

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

描述

Using this code on version 0.7.0:

pk_query_params = {
            pkcs11.Attribute.CLASS: pkcs11.ObjectClass.PRIVATE_KEY
        }
        q = session.get_objects(pk_query_params)        
        results = list(q)
on Nexus Personal PKCS11 driver fails with:
    results = list(q)
  File "pkcs11/_pkcs11.pyx", line 322, in pkcs11._pkcs11.SearchIter.__next__
  File "pkcs11/_pkcs11.pyx", line 692, in pkcs11._pkcs11.Object._make
  File "pkcs11/_pkcs11.pyx", line 723, in pkcs11._pkcs11.Object.__getitem__
  File "pkcs11/_utils.pyx", line 35, in pkcs11._pkcs11._unpack_attributes
  File "/home/miha/.local/lib/python3.10/site-packages/pkcs11/defaults.py", line 116, in <lambda>
    _bool = (Struct('?').pack, lambda v: Struct('?').unpack(v)[0])
struct.error: unpack requires a buffer of 1 bytes
Exception ignored in: <cyfunction SearchIter.__del__ at 0x7f58cf9cea80>
Traceback (most recent call last):
  File "pkcs11/_pkcs11.pyx", line 326, in pkcs11._pkcs11.SearchIter.__del__
  File "pkcs11/_pkcs11.pyx", line 336, in pkcs11._pkcs11.SearchIter._finalize
  File "pkcs11/_errors.pyx", line 88, in pkcs11._pkcs11.assertRV
pkcs11.exceptions.SessionHandleInvalid: 
主要语言
Python
星标
171
派生
79
平均合并
14 小时 23 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

pyauth/python-pkcs11 的其他 Issue

查看 pyauth/python-pkcs11 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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