Align container user's home directory value in /etc/passwd and HOME env variable
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
The Gemnasium analyzers have a mismatch between the home directory value in /etc/passwd and the HOME environment variable. This has caused issues in the past as can be seen in #374571 (closed).
To prevent this from happening in the future elsewhere, and to prevent a regression of #374571 (closed), we should align these values. Here's an example of how the /etc/passwd file looks like in gemnasium-maven.
root@58a0e8bc3a26:~# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
And here's how $HOME is set:
root@58a0e8bc3a26:~# echo $HOME
/gemnasium-maven
The correct behavior would be for the /etc/passwd file to contain:
root@58a0e8bc3a26:~# cat /etc/passwd
root:x:0:0:root:/gemnasium-maven:/bin/bash
Improvements
Removes the possibility of a regression of Cloning project over SSH fails when using gemna... (#374571 - closed) • Yasha Rise • 17.1.
Risks
- Editing a
/etc/passwdfile manually (withoutusermodoruseradd) is risky. We could mitigate this by adding agitlabnon-root user instead. If Improve Dependency Scanning support with non-ro... (#431945) is completed then the new user should be checked to ensure consistency between$HOMEand/etc/passwd
Involved components
-
build/*/*/Dockerfile- All the
Dockerfilefiles will need to be updated to use the correct home directory.
- All the
Edited by 🤖 GitLab Bot 🤖