jfrog-cli icon indicating copy to clipboard operation
jfrog-cli copied to clipboard

JFrog CLI fails, if there is a directory /tmp/jfrog, which is not owned by the current user

Open adityaramesh7 opened this issue 1 year ago • 0 comments

Describe the bug

The JFrog CLI fails to execute if a directory named /tmp/jfrog is not owned by the current user. When User A, who has full access to the directory, runs the jf bce command, it executes successfully. However, when User B, who only has read and execute permissions, attempts to run the same command, a "permission denied" error occurs.

Current behavior

su - user1
Last login: Tue Jul 30 12:53:12 UTC 2024 on pts/0
[user1@adityar-centos9 ~]$ cd /tmp/jfrog/
[user1@adityar-centos9 jfrog]$ export JFROG_CLI_LOG_LEVEL="DEBUG"
[user1@adityar-centos9 jfrog]$ jf rt bce a b
06:55:33 [Debug] JFrog CLI version: 2.61.2
06:55:33 [Debug] OS/Arch: linux/amd64
06:55:33 [Debug] Trace ID for JFrog Platform logs: b8e78780db418691
06:55:33 [🔵Info] Collecting environment variables...
06:55:33 [Debug] Reading build general details from: /tmp/jfrog/builds/0d95fb310c002d398282654740a3ee422ddf14b11a8d0bb8df04af14199b33a1/partials
06:55:33 [Debug] No servers were configured.
06:55:33 [Debug] Creating temp build file at: /tmp/jfrog/builds/0d95fb310c002d398282654740a3ee422ddf14b11a8d0bb8df04af14199b33a1/partials
06:55:33 [🔵Info] Collected environment variables for a/b.
su - user2
Last login: Tue Jul 30 12:53:35 UTC 2024 on pts/0
[user2@adityar-centos9 ~]$ cd /tmp/jfrog/
[user2@adityar-centos9 jfrog]$ export JFROG_CLI_LOG_LEVEL="DEBUG"
[user2@adityar-centos9 jfrog]$ jf rt bce e x
06:57:04 [Debug] JFrog CLI version: 2.61.2
06:57:04 [Debug] OS/Arch: linux/amd64
06:57:04 [Debug] Trace ID for JFrog Platform logs: df3b05cf60c21c83
06:57:04 [🔵Info] Collecting environment variables...
06:57:04 [Debug] No servers were configured.
06:57:04 [🔵Info] Trace ID for JFrog Platform logs: df3b05cf60c21c83
06:57:04 [🚨Error] mkdir /tmp/jfrog/builds/1095ef206c3342b07180cb508f4c82dbd8283acc96134d3f5f0b31a24c2f3559: permission denied

Reproduction steps

On Linux Host (tested on Centos 9)
mkdir /tmp/jfrog
adduser user1
adduser user2
chown user1 /tmp/jfrog

$ ls -lartd /tmp/jfrog/
drwxr-xr-x. 3 user1 root 20 Jul 18 14:07 /tmp/jfrog/

user A: $ su - user1
$ cd /tmp/jfrog
$ jf rt bce a b
14:07:53 [:large_blue_circle:Info] Collecting environment variables...
14:07:53 [:large_blue_circle:Info] Collected environment variables for a/b.

user B: $ su - user2
$ jf rt bce e x
14:08:24 [:large_blue_circle:Info] Collecting environment variables...
14:08:24 [:rotating_light:Error] mkdir /tmp/jfrog/builds/1095ef206c3342b07180cb508f4c82dbd8283acc96134d3f5f0b31a24c2f3559: permission denied

Expected behavior

Executing the command jf rt bce e x does not inherently require write privileges in the current directory because the primary function of this command is to collect environment variables related to a build and send them to JFrog Artifactory.

JFrog CLI version

2.61.2

Operating system type and version

Linux - Centos9

JFrog Artifactory version

No response

JFrog Xray version

No response

adityaramesh7 avatar Jul 31 '24 07:07 adityaramesh7