SearchItems returns no locked items, so libsecret never prompts to unlock
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust
调研方向
Start with search_inner_items in server/src/collection/mod.rs and trace how SearchItems handles a locked keyring and attribute matching. The issue explains why returning every locked item can expose the wrong secret, so investigate how matching could work while locked. Done means a lookup prompts to unlock the matching item and returns its secret without returning unrelated items; the reproduction uses secret-tool and busctl.
由索引模型根据 Issue 内容生成。
描述
When the login collection is locked, SearchItems returns both arrays empty, including the locked array. libsecret's secret_password_lookup unlocks an item only when the search reports it in locked. With both arrays empty, it concludes that no matching secret exists. The application is told the secret doesn't exist, with no unlock prompt and no error.
Environment
- oo7
mainat 901e7406 ("python: stop shipping stray type stub files"), plus one unrelated patch that retries the daemon's connect to the login helper at startup - libsecret 0.21.8, with
secret-toolas the client - oo7-daemon as the only Secret Service provider, on a private session bus with an empty
XDG_DATA_HOME. The login collection was unlocked at startup throughoo7-daemon-login.
Steps to reproduce
$ C=/org/freedesktop/secrets/collection/login
$ echo -n topsecret | secret-tool store --label=test service demo key demo
$ secret-tool lookup service demo key demo
topsecret
$ busctl --user call org.freedesktop.secrets /org/freedesktop/secrets \
org.freedesktop.Secret.Service SearchItems "a{ss}" 2 service demo key demo
aoao 1 "/org/freedesktop/secrets/collection/login/1" 0
$ secret-tool lock --collection=$C
$ busctl --user get-property org.freedesktop.secrets $C \
org.freedesktop.Secret.Collection Locked
b true
$ busctl --user call org.freedesktop.secrets /org/freedesktop/secrets \
org.freedesktop.Secret.Service SearchItems "a{ss}" 2 service demo key demo
aoao 0 0
$ secret-tool lookup service demo key demo; echo "rc=$?"
rc=1
The final lookup returns in about 40 ms. No prompt appears and nothing is printed.
The item is still there:
$ busctl --user get-property org.freedesktop.secrets $C org.freedesktop.Secret.Collection Items
ao 1 "/org/freedesktop/secrets/collection/login/1"
$ busctl --user get-property org.freedesktop.secrets $C/1 org.freedesktop.Secret.Item Locked
b true
Expected
SearchItems returns aoao 0 1 "/org/freedesktop/secrets/collection/login/1". libsecret then calls Unlock on that path, the prompter asks for the password, and the lookup returns the secret.
Cause
search_inner_items in server/src/collection/mod.rs returns early while the keyring is locked:
if keyring.is_locked() {
return Ok(Vec::new());
}
The stored attribute hashes are MACs keyed with the keyring key, so a locked keyring can't match attributes at all.
Returning every locked item is not a safe fix
It might look as if SearchItems could return all of the collection's items in locked without matching them. libsecret doesn't search again after unlocking, though. on_lookup_searched in libsecret/secret-methods.c unlocks only locked[0], and on_lookup_unlocked then returns the secret of whatever item that was:
} else if (locked && locked[0]) {
const gchar *paths[] = { locked[0], NULL };
secret_service_unlock_dbus_paths (self, paths, cancellable,
on_lookup_unlocked, ...);
With unmatched candidates in locked, a lookup would hand an application some other item's secret. Fixing this needs a way to match attributes while the keyring is locked.
Impact
- Only reads are affected.
secret-tool storeinto a locked collection prompts and works, because writing needs the collection open. A prompter can therefore look healthy while every lookup fails without a sound. - An application told that no secret exists may decide nothing was ever stored and write a fresh credential over the old one.
- This hits whenever the login collection ends up locked during a session: after a daemon restart, an explicit lock, or a login where no password reaches
pam_oo7(for example a FIDO2 login).
I found this with AI assistance (Claude Opus 5.5) while testing oo7 as a gnome-keyring replacement. The reproduction above was run on the oo7 commit listed under Environment.
- 主要语言
- Rust
- 星标
- 481
- 派生
- 62
- 平均合并
- 9 小时 51 分钟
- 30 天内合并 PR
- 55
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
linux-credentials/oo7 的其他 Issue
-
NoNewPrivileges blocks CAP_IPC_LOCK for oo7-daemon可能重新可做 关联的 PR 已关闭且未合并。 未关闭server
难度 2/5 1-3 小时 新手友好度 67/100
linux-credentials/oo7#645 · 4 条评论 ·
维护者通常 1 天内回复
-
server
难度 4/5 3-5 天 新手友好度 48/100
linux-credentials/oo7#685 · 4 条评论 ·
维护者通常 1 天内回复
-
question server
难度 5/5 一周以上 新手友好度 20/100
linux-credentials/oo7#642 · 8 条评论 ·
维护者通常 1 天内回复
-
question server
难度 3/5 半天 新手友好度 35/100
linux-credentials/oo7#603 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement server
难度 5/5 一周以上 新手友好度 25/100
linux-credentials/oo7#593 · 1 条评论 ·
维护者通常 1 天内回复
查看 linux-credentials/oo7 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
needs triage
难度 2/5 1-3 小时 新手友好度 76/100
pbakaus/impeccable#1620 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
swc-project/swc-next-issues#533 ·
-
bug
难度 2/5 1-3 小时 新手友好度 77/100
nautechsystems/nautilus_trader#5718 ·
维护者通常 1 天内回复
-
`luvus --remote` cannot start on a host whose login shell is Nushell可能已有人在做 @schlich 今天认领。 未关闭status: needs triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 4 天内回复