fix: prevent symlink attack in removeLoginKeyring#1040
Merged
ComixHe merged 1 commit intolinuxdeepin:masterfrom Mar 2, 2026
Merged
fix: prevent symlink attack in removeLoginKeyring#1040ComixHe merged 1 commit intolinuxdeepin:masterfrom
ComixHe merged 1 commit intolinuxdeepin:masterfrom
Conversation
The removeLoginKeyring() function previously accessed files in user's home directory as root using full paths, which could be exploited for local DoS attacks or deleting arbitrary users' login.keyring files via symlink attacks. These changes ensure that all file operations are performed on the verified directory, preventing symlink-based attacks. Pms: BUG-349987 Log: prevent symlink attack in removeLoginKeyring Signed-off-by: ComixHe <heyuming@deepin.org>
deepin pr auto reviewGit Diff 代码审查报告总体评价这段代码修改主要将 语法逻辑分析
代码质量评价
代码性能分析
代码安全性评价
改进建议
总结这段代码修改通过使用系统调用替代标准库函数,提高了代码的安全性和性能。主要改进点包括防止符号链接攻击、减少竞态条件、精确控制文件访问等。但仍有优化空间,如提取常量、增强错误处理、添加更详细的安全检查等。建议采纳上述改进建议,进一步提高代码质量、安全性和可维护性。 |
fly602
approved these changes
Mar 2, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ComixHe, fly602 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The removeLoginKeyring() function previously accessed files in user's home directory as root using full paths, which could be exploited for local DoS attacks or deleting arbitrary users' login.keyring files via symlink attacks.
These changes ensure that all file operations are performed on the verified directory, preventing symlink-based attacks.
Pms: BUG-349987
Log: prevent symlink attack in removeLoginKeyring