Skip to content

security: run Etherpad container as non-root user (fixes #7134)#7287

Merged
SamTV12345 merged 1 commit intoether:developfrom
1234-ad:security/fix-docker-compose-root-user
Jan 10, 2026
Merged

security: run Etherpad container as non-root user (fixes #7134)#7287
SamTV12345 merged 1 commit intoether:developfrom
1234-ad:security/fix-docker-compose-root-user

Conversation

@1234-ad
Copy link
Contributor

@1234-ad 1234-ad commented Jan 10, 2026

Description

This PR addresses a security concern raised in issue #7134 by changing the Docker Compose configuration to run the Etherpad container as a non-root user instead of root.

Problem

The current docker-compose.yml explicitly sets user: "0:0", which runs the Etherpad application as the root user inside the container. This violates the principle of least privilege and creates unnecessary security risks.

Solution

Changed the user from "0:0" (root) to "5001:0" (etherpad user with root group) to align with the Dockerfile's existing security model.

The Dockerfile already creates a non-root user named etherpad with:

  • UID: 5001
  • GID: 0 (root group for OpenShift compatibility)

This change simply makes the docker-compose.yml configuration consistent with the Dockerfile's security design.

Changes Made

  • docker-compose.yml: Changed user: "0:0" to user: "5001:0"

Benefits

🔒 Security Improvements

  • Reduces Attack Surface: Running as non-root limits potential damage from container breakouts
  • Principle of Least Privilege: Application runs with minimal necessary permissions
  • Industry Best Practice: Aligns with Docker and container security guidelines

🚀 Platform Compatibility

  • OpenShift Compatible: Many platforms (like OpenShift) prohibit root containers
  • Kubernetes Ready: Better compatibility with security policies and pod security standards
  • Enterprise Friendly: Meets security requirements for enterprise deployments

🔧 Technical Alignment

  • Consistent with Dockerfile: Matches the non-root user already defined in the Dockerfile
  • Volume Permissions: Maintains GID 0 for proper volume access
  • No Breaking Changes: Etherpad already runs as non-root in the container

Testing

Verification Steps

  1. ✅ Verified UID 5001 matches the Dockerfile's etherpad user
  2. ✅ Confirmed GID 0 maintains volume access permissions
  3. ✅ Checked that the Dockerfile already runs as non-root user
  4. ✅ Validated no breaking changes to existing functionality

Recommended Testing

# Test the updated docker-compose configuration
docker-compose up -d

# Verify the container is running as non-root
docker-compose exec app id
# Expected output: uid=5001(etherpad) gid=0(root) groups=0(root)

# Verify Etherpad is accessible
curl http://localhost:9001/

# Check file permissions in volumes
docker-compose exec app ls -la /opt/etherpad-lite/var
docker-compose exec app ls -la /opt/etherpad-lite/src/plugin_packages

Security Impact

Before

  • Container runs as root (UID 0)
  • Full system privileges inside container
  • Higher risk if container is compromised

After

  • Container runs as etherpad user (UID 5001)
  • Limited privileges inside container
  • Reduced risk and blast radius

Compatibility

  • Backward Compatible: No changes to application behavior
  • Volume Permissions: GID 0 ensures proper file access
  • Existing Deployments: Should work seamlessly with existing setups
  • ⚠️ Note: If you have custom volume permissions set for root, you may need to adjust them

Related Issues

Fixes #7134

Additional Context

This change was requested by @techware01 in issue #7134, and @SamTV12345 asked for a merge request. The Dockerfile has always created a non-root user, so this change simply makes the docker-compose.yml configuration consistent with that design.

Checklist


Note: This is a security improvement with minimal risk. The Dockerfile already runs as non-root, so this change simply removes the override that forced root execution in docker-compose deployments.

Change the Docker Compose user from "0:0" (root) to "5001:0" (etherpad user)
to follow security best practices and the principle of least privilege.

The Dockerfile already creates a non-root user 'etherpad' with UID 5001
and GID 0, so this change aligns the docker-compose.yml configuration
with the Dockerfile's security model.

Benefits:
- Reduces attack surface by not running as root
- Follows Docker security best practices
- Aligns with the Dockerfile's existing non-root user setup
- Compatible with OpenShift and other platforms that restrict root containers
- Maintains group permissions (GID 0) for volume access

Fixes ether#7134
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a security concern by changing the Docker Compose configuration to run Etherpad as a non-root user instead of root, aligning with the principle of least privilege and the Dockerfile's existing security design.

Changes:

  • Modified docker-compose.yml to run the Etherpad container as user 5001:0 (etherpad user with root group) instead of 0:0 (root user)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

services:
app:
user: "0:0"
user: "5001:0"
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

The README.md file contains a docker-compose example that still has user: "0:0" on line 51. For consistency and to fully address issue #7134, this example should also be updated to user: "5001:0" to match the change made in docker-compose.yml. The issue specifically mentioned that the README's compose file should be updated as well.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

@SamTV12345 SamTV12345 merged commit 9ff003c into ether:develop Jan 10, 2026
30 checks passed
@SamTV12345
Copy link
Member

Thanks for the fix :)

@1234-ad
Copy link
Contributor Author

1234-ad commented Jan 10, 2026

Thank you.

@techware01
Copy link

Thank you for fixing this issue :)

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.

Security Concern: Running Etherpad as Root User in Docker Compose

3 participants