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

Enhance Security: Run Container with Non-Root User Fixed #4091 #4092

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Sarvesh2783
Copy link

This pull request improves the security of the Docker container by introducing a non-root user. It uses the default root user and hence the container is based on the principle of least privilege. Therefore, it reduces the probability of privilege escalation and ensures that the container is safer to operate.

Differences:
1.Added a non-root user (appuser) and group (appgroup).
2.Updated file permissions to give ownership to the non-root user.
3.Configured to run as non-root user inside the container.
Benefits:
1.It minimizes the plausible impact of security flaws. Best Practices for Container Security.

@walterbender
Copy link
Member

Is this not redundant? isn't there already an adduser?

@Sarvesh2783
Copy link
Author

@walterbender Thanks for pointing that out! While some base images might already have a non-root user, I added appuser to ensure consistency and explicitly configure permissions for this container. This makes it clear who owns and runs what, reducing any reliance on base image defaults that could vary.
If there’s already a non-root user we can use, I’m happy to adjust—just wanted to follow best practices here. Let me know what you think!

@walterbender
Copy link
Member

Maybe you can rebase and check your changes against the current master. I think your changes are an improvement but there is something out of sync.

@Sarvesh2783
Copy link
Author

Thanks for the feedback, Walter! I’ll rebase my changes against the current master to ensure everything is in sync and verify any overlaps. I’ll update the PR once it’s tested. Let me know if there’s anything specific you’d like me to focus on

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.

2 participants