Skip to content

feat: support expired password changes on lock and greeter - #108

Merged
yixinshark merged 1 commit into
linuxdeepin:masterfrom
yixinshark:feat/expired-password-change
Nov 6, 2026
Merged

yixinshark merged 1 commit into
linuxdeepin:masterfrom
yixinshark:feat/expired-password-change

Conversation

@yixinshark

@yixinshark yixinshark commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add a shared current/new/confirmation password form with an optional hint for expired-password changes on lock and greeter. The lock gate is opt-in through stopUnlockWhenPasswordExpired (default false); greeter follows the LightDM/PAM conversation. Check new passwords with the local pwcheck policy before submission, and adapt build dependencies to the target repository's existing packaging.
  • Return to ordinary authentication after one minute of inactivity. Clear drafts and reject delayed results on suspend, session deactivation, user changes and navigation. Keep passwordless suspend recovery locked, prevent revealed passwords from reaching PRIMARY, and discard hint undo history when resetting the form.
  • Refresh Accounts password-expiry information after successful biometric authentication. Discard unused password candidates for successful single-factor face/iris/fingerprint authentication, and clear the cache on token-delivery errors. Confirmed valid passwords unlock directly; expired passwords enter the change form; unavailable or unknown expiry information requires a current-password PAM check. MFA retains its verified password, and cancellation still requires fresh authentication.

Validation

  • Qt 6.8 Debug builds completed for dde-lock, lightdm-deepin-greeter, dde-lock-test and lightdm-deepin-greeter-test, based on upstream/master (829ad62b).
  • Functional assertions passed for all 192 lock/controller/input/recovery tests, including the four new cache-cleanup cases, with no skipped cases. Explicit filters include the upstream recovery suites; the default filter includes all four UT_LockPasswordSession tests. The previous 50 greeter form/recovery tests remain valid for the unchanged greeter target.
  • The asynchronous SetToken-error probe passed 2 cases and the probe using local snipe's sender passed 5 cases. Both probe processes exited 0 with leak detection enabled. The local probe reuses cached Qt/D-Bus bindings while verifying that the exercised lock functions and controller match local sources; it does not replace a full local application build.
  • Leak detection remained enabled. The full lock run exits 1; the unchanged greeter target's previous run also exited 1: the lock run reports 17,230 bytes / 178 allocations (libdeepin_pw_check plus existing Qt D-Bus startup watchers exposed by the upstream restart tests); the greeter run reports 3,720 bytes / 48 allocations (GLib/LightDM plus existing SFAWidget animations). Only the existing DTK preference and Qt gesture suppressions were used; no invalid memory accesses were reported.
  • Full Qt 5 builds remain unverified because this environment lacks liblightdm-qt5-3. Live PAM/AD authentication and physical X11/Wayland UI acceptance remain to be verified on a test machine; the regression runs use mocked authentication and do not change real account passwords.

@sourcery-ai

sourcery-ai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Sorry @yixinshark, your pull request is larger than the review limit of 150,000 diff characters

@yixinshark
yixinshark force-pushed the feat/expired-password-change branch from a286ed1 to 897085b Compare November 5, 2026 10:41
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 5, 2026
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#108
@yixinshark
yixinshark force-pushed the feat/expired-password-change branch from 897085b to 98dbefa Compare November 6, 2026 03:36
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 6, 2026
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#108
@yixinshark
yixinshark force-pushed the feat/expired-password-change branch from 98dbefa to 5914b73 Compare November 6, 2026 05:46
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 6, 2026
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#108
@yixinshark
yixinshark force-pushed the feat/expired-password-change branch from 5914b73 to be96ccf Compare November 6, 2026 06:10
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 6, 2026
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#108
@yixinshark
yixinshark force-pushed the feat/expired-password-change branch from be96ccf to 22faf0a Compare November 6, 2026 06:18
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 6, 2026
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#108
Add an opt-in lock password-expiry gate and a shared form for the current
password, new password, confirmation and optional hint. Follow the
greeter's LightDM/PAM password-change conversation and check the local
password policy with pwcheck before submission.

Return to ordinary authentication after one minute of inactivity. Clear
draft credentials and invalidate pending results when suspending,
deactivating the session, switching users or leaving authentication.
Protect revealed passwords from PRIMARY export and discard hint undo
history when resetting the form.

Refresh Accounts expiry after successful biometric authentication so
accounts with valid passwords can unlock without entering the change
form. Discard unused password candidates before single-factor biometric
completion and clear the cache on token-delivery errors. Preserve verified
MFA credentials and fresh authentication after password-change cancellation.
Cover the lock gate, greeter conversation and secure inputs with isolated
regression tests.

增加默认关闭的锁屏密码过期拦截配置,复用旧密码、新密码、确认密码和可选
提示的同页表单。登录器遵循 LightDM/PAM 改密对话,提交前使用 pwcheck
检查本地密码策略。

空闲一分钟后返回普通认证页。待机、会话失活、切换用户或离开认证页时,
清空密码草稿并使未完成结果失效。阻止明文密码导出到 PRIMARY 选择区,
重置表单时清除密码提示的撤销历史。

生物认证成功后重新查询 Accounts 密码有效期,密码正常时直接解锁,避免
误入改密页。单因生物认证成功或令牌发送失败时清除未使用的密码提交缓存,
保留多因认证凭据及取消改密后的重新认证要求。补充锁屏拦截、登录器对话
和安全输入的隔离回归测试。

Log: support expired password changes on lock and greeter
Change-Id: I182356829461e02adb570caa990a884fd46b639c
@yixinshark
yixinshark force-pushed the feat/expired-password-change branch from 22faf0a to f3a477f Compare November 6, 2026 07:07
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 6, 2026
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#108
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 94 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本 PR 为 dde-session-shell 的锁屏和登录界面新增过期密码修改功能,引入 LockPasswordChange(锁屏端,使用 PAM 账户校验 + passwd 进程改密)和 GreeterPasswordChange(登录端,适配 LightDM 改密会话)两个新类。代码整体质量高,四维度均通过,无安全漏洞。语法逻辑方面状态机设计严谨,使用 generation 计数器防止过期回调,正确处理会话失活、休眠/休眠恢复、用户切换等边界场景;代码质量方面注释充分、关注点分离清晰,部分函数较长但符合 Qt 信号连接惯例;性能方面 PAM 校验和 passwd 均在非 UI 线程/异步执行,MO 文件目录有缓存;安全方面密码处理极为谨慎——清除前填零、passwd 输出脱敏、截断输出返回通用错误、PAM 会话仅允许单次密码提示、未知 PAM 提示触发取消以防凭据泄露、locale 路径校验防目录遍历、用户身份校验防越权改密、新增 D-Bus 调用源校验。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['考虑在 submitPasswords 中添加注释或断言,明确说明 m_checkAfterCurrentPassword 早返回保证不会跳过 startAccountCheck', 'respondToPrompts 的批次验证循环可提取为独立方法 validateBatch(),提高可读性']


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['将 LockWorker 构造函数中的密码改密信号连接提取为独立的 initPasswordChangeConnections() 方法', '考虑将密码校验逻辑(非空、ASCII、提示不含密码)提取为共享工具函数']


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['将 250ms、50ms 等定时器间隔提取为命名常量,如 constexpr int kExpiryCheckDelay = 250']


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: ['lockpasswordchange.cpp startProcess: m_oldPassword.toUtf8() 和 m_newPassword.toUtf8() 产生的临时 QByteArray 在连接后释放但未填零,虽属 C++ 语言限制且整体防御已非常充分,可考虑使用 QByteArray 且在用后手动填零再释放']


💡 改进建议代码示例

// lockpasswordchange.cpp - startProcess 中临时 QByteArray 填零建议
void LockPasswordChange::startProcess()
{
    // ...
    connect(process, &QProcess::started, this, [this, process] {
        if (m_process != process) {
            return;
        }
        QByteArray oldPwd, newPwd;
        if (!m_skipCurrentPassword) {
            oldPwd = m_oldPassword.toUtf8();
        }
        newPwd = m_newPassword.toUtf8();
        QByteArray responses;
        if (!m_skipCurrentPassword) {
            responses = oldPwd + '\n';
        }
        responses += newPwd + '\n' + newPwd + '\n';
        process->write(responses);
        responses.fill('\0');
        oldPwd.fill('\0');  // 清除临时副本
        newPwd.fill('\0');   // 清除临时副本
        process->closeWriteChannel();
    });
    // ...
}

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: robertkill, yixinshark

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yixinshark
yixinshark merged commit 6bde765 into linuxdeepin:master Nov 6, 2026
15 of 16 checks passed
yixinshark pushed a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 6, 2026
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants