Skip to content
New issue

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

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

Already on GitHub? # to your account

Dockerfile doesn't specify USER #5070

Open
SbruiceS opened this issue Dec 10, 2024 · 1 comment
Open

Dockerfile doesn't specify USER #5070

SbruiceS opened this issue Dec 10, 2024 · 1 comment

Comments

@SbruiceS
Copy link

Description

By not specifying a USER, a program in the container may run as root. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than root.

images/orderer/Dockerfile:73
{CMD [ "orderer", "start" ]}

images/peer/Dockerfile:77

{VOLUME /etc/hyperledger/fabric
VOLUME /var/hyperledger

EXPOSE 7051

CMD [ "peer", "node", "start" ]}

References

https://owasp.org/Top10/A04_2021-Insecure_Design

Steps to reproduce

No response

@SbruiceS SbruiceS added the bug label Dec 10, 2024
@denyeart
Copy link
Contributor

denyeart commented Dec 23, 2024

Thanks for the issue, you are correct, for production deployments a non-root USER is indeed recommended.

The Docker image built in this repository and the associated usage in fabric-samples repository are for education and test purposes only as mentioned at https://github.com/hyperledger/fabric/tree/main/images/peer. root is utilized for simplicity in the samples to interact with the Docker daemon when building and starting chaincodes.

Production deployments should specify a USER and are encouraged to use a chaincode build and run approach appropriate for the production environment (e.g. Kubernetes based), see https://hyperledger-fabric.readthedocs.io/en/latest/cc_launcher.html.

We can utilize this issue to make the recommendation more clear, I'll update the title and remove the bug label accordingly.

@denyeart denyeart removed the bug label Dec 23, 2024
@denyeart denyeart changed the title big security issue - missing-user Dockerfile doesn't specify USER Dec 23, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants