fix(security): 2 improvements across 1 files#1789
Open
Nam0101 wants to merge 1 commit into
Open
Conversation
- Security: Overly permissive file permissions (chmod 777) on custom diff binary
- Security: Fragile path parsing via split(" ") can target unintended files
Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
|
您好!很高兴收到您的邮件,稍后查看。
|
|
这是来自QQ邮箱的自动回复邮件。您好,来信已收到,谢谢您,我会及时回复您的!O(∩_∩)O~
|
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.
Summary
fix(security): 2 improvements across 1 files
Problem
Severity:
High| File:tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/util/DiffFactory.java:L30DiffFactory.makeSurePermission() executes
chmod 777on the user-supplied custom diff binary path. World-writable and world-executable permissions allow any local user on the build machine to overwrite the binary with malicious code, which would then be executed during patch builds. On shared/CI systems this enables local privilege escalation or supply-chain tampering.chmod 755is sufficient to make the binary executable for the build user.Solution
Replace
chmod 777withchmod 755(or700). Also consider verifying the binary's integrity (hash check) before execution rather than blindly making it world-writable.Changes
tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/util/DiffFactory.java(modified)Testing
Note: this change was drafted with AI assistance and reviewed locally before submission.