Skip to content

fix(security): 2 improvements across 1 files#1789

Open
Nam0101 wants to merge 1 commit into
Tencent:devfrom
Nam0101:contribai/fix/security/overly-permissive-file-permissions-chmod
Open

fix(security): 2 improvements across 1 files#1789
Nam0101 wants to merge 1 commit into
Tencent:devfrom
Nam0101:contribai/fix/security/overly-permissive-file-permissions-chmod

Conversation

@Nam0101
Copy link
Copy Markdown

@Nam0101 Nam0101 commented May 16, 2026

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:L30

DiffFactory.makeSurePermission() executes chmod 777 on 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 755 is sufficient to make the binary executable for the build user.

Solution

Replace chmod 777 with chmod 755 (or 700). 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

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

Note: this change was drafted with AI assistance and reviewed locally before submission.

- 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>
@jacklongway
Copy link
Copy Markdown

jacklongway commented May 16, 2026 via email

@canlan818
Copy link
Copy Markdown

canlan818 commented May 16, 2026 via email

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