fix: SMB共享凭证加入share name属性隔离 - #383
Conversation
1. Root cause: DNetworkMounter's keyring credential management
(savePasswd/loginPasswd/smbSchema) did not include share name,
so loginPasswd searched by {server, protocol} only and returned
all saved credentials for the same server regardless of share
2. Fix: add "object" attribute to smbSchema for share name, extract
share from URL path in savePasswd and loginPasswd, include it in
both store and search operations to isolate credentials per share
3. Impact: credentials are now stored and searched per-share; old
credentials without "object" attribute won't be matched, users
need to re-enter password once per share after upgrade
4. 方案层级: 根因层修复(5-Why 在 Why 4 收敛,根因层与症状层一致)
Log: fix SMB share only authenticating once across different users
Influence:
1. Test accessing non-anonymous shares of different users on the
same server, second share should prompt for authentication
2. Test re-accessing a saved share, credential should auto-fill
3. Test anonymous share access is unaffected
4. Test FTP/WebDAV mounting is unaffected
fix: SMB共享凭证加入share name属性隔离
1. 根因:DNetworkMounter 的 keyring 凭证管理(savePasswd/loginPasswd/
smbSchema)未包含 share name 属性,loginPasswd 仅按
{server, protocol} 搜索,返回同一服务器所有共享的已保存凭证
2. 方案:在 smbSchema 中新增 "object" 属性用于 share name,
savePasswd 和 loginPasswd 从 URL 提取 share name 并在存储和
查询时附带,实现凭证按共享级别隔离
3. 影响:凭证按共享级别存储和搜索,旧凭证不含 "object" 属性
无法命中,升级后用户需对每个已保存共享重新输入一次密码
4. 方案层级:根因层修复(5-Why 在 Why 4 收敛,根因层与症状层一致)
Log: 修复访问不同用户不同密码的SMB共享时仅鉴权一次的问题
Influence:
1. 测试同一服务器不同用户的非匿名共享,访问第二个共享应弹出鉴权窗口
2. 测试重复访问已保存的共享,凭证应自动填充无需再次输入
3. 测试匿名共享访问不受影响
4. 测试 FTP/WebDAV 挂载不受影响
PMS: BUG-375291
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes SMB credential leakage across shares on the same server by deriving the share name from the URL and including it in the keyring schema, searches, and saves. Existing credentials without the new attribute will not match and must be re-entered per share once after upgrade. Sequence diagram for per-share SMB credential lookup and storagesequenceDiagram
participant Mounter as DNetworkMounter
participant Keyring as SecretServiceKeyring
Mounter->>Mounter: QUrl::path()
Mounter->>Keyring: secret_password_lookup_sync(server, protocol, object=share)
alt matching share credential exists
Keyring-->>Mounter: saved password
else no matching share credential
Keyring-->>Mounter: no credential
end
Mounter->>Keyring: secret_password_store_sync(server, protocol, user, object=share)
Keyring-->>Mounter: credential stored per share
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto reviewAI 代码审查报告
总体评价
修改文件清单
跳过文件统计:共 1 个文件修改,0 个文件跳过。 四维度评分详情维度1:语法逻辑(25分,权重25%)评分:25/25 ✓ 语法正确,逻辑清晰 变更精准修复了 SMB 共享凭证隔离问题,修改涉及三个核心函数 1.新增常量
维度2:代码质量(25分,权重25%)评分:24/25 ✓ 代码结构清晰,注释完整 1.新增属性 1.新增常量 // 建议添加注释
static constexpr char kSchemaObject[] { "object" }; // SMB share name for credential isolation维度3:代码性能(20分,权重20%)评分:20/20 ✓ 性能良好,资源使用合理 1. 维度4:代码安全(30分,权重30%)评分:30/30 ✓ 存在0个安全漏洞 漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个 安全分析: 1. 改进建议// 建议:为 kSchemaObject 添加注释说明用途
-static constexpr char kSchemaObject[] { "object" };
+// SMB share name attribute for per-share credential isolation
+static constexpr char kSchemaObject[] { "object" };审查结论本次提交精准修复了 SMB 共享凭证无法按共享名隔离的 BUG(PMS BUG-375291),通过在 libsecret SecretSchema 中新增 "object" 属性并在存储和查询时携带 share name,实现了凭证的共享级别隔离。代码变更范围小(+9/-2),逻辑正确,风格与现有代码一致,无安全漏洞。PR 描述质量很高,包含完整的根因分析和测试方案。 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
fix: include share name in SMB keyring credentials
(savePasswd/loginPasswd/smbSchema) did not include share name,
so loginPasswd searched by {server, protocol} only and returned
all saved credentials for the same server regardless of share
share from URL path in savePasswd and loginPasswd, include it in
both store and search operations to isolate credentials per share
credentials without "object" attribute won't be matched, users
need to re-enter password once per share after upgrade
Log: fix SMB share only authenticating once across different users
Influence:
same server, second share should prompt for authentication
fix: SMB共享凭证加入share name属性隔离
smbSchema)未包含 share name 属性,loginPasswd 仅按
{server, protocol} 搜索,返回同一服务器所有共享的已保存凭证
savePasswd 和 loginPasswd 从 URL 提取 share name 并在存储和
查询时附带,实现凭证按共享级别隔离
无法命中,升级后用户需对每个已保存共享重新输入一次密码
Log: 修复访问不同用户不同密码的SMB共享时仅鉴权一次的问题
Influence:
PMS: BUG-375291
Summary by Sourcery
Bug Fixes: