Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup PATH variable mangling #1026

Closed
wants to merge 9 commits into from
Closed
8 changes: 7 additions & 1 deletion Dockerfile_mbtci_template
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ RUN set -ex \
&& python2.7 --version \
&& python3 --version

# Allow global npm packages install without sudo
RUN set -ex \
&& mkdir ${MTA_USER_HOME}/.npm-global \
jerome-benoit marked this conversation as resolved.
Show resolved Hide resolved
&& chown -R ${MTA_USER}:${MTA_USER} ${MTA_USER_HOME}
ENV NPM_CONFIG_PREFIX ${MTA_USER_HOME}/.npm-global
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the spec it's
ENV <key>=<value>
does it work without the equal too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are working. The current Dockerfile use space, so let's keep it consistent with the style already used.


ENV PATH=$PATH:./node_modules/.bin HOME=${MTA_USER_HOME}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the image i used i do not have this path entry:

mta@63fceb6d640d:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

is it intended that the root user has the home of mta?

root@b40df04c7063:/project# id
uid=0(root) gid=0(root) groups=0(root)
root@b40df04c7063:/project# echo $HOME
/home/mta

Copy link
Collaborator Author

@jerome-benoit jerome-benoit Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not intended and a genuine security bug, and as well as the HOME env variable redefinition.
The PATH env variable mangling is buggy as hell in that Dockerfile. I plan to fix it but in another PR.

Thanks.

jerome-benoit marked this conversation as resolved.
Show resolved Hide resolved
WORKDIR /project
USER ${MTA_USER}
USER ${MTA_USER}