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

fix: Ensure application files are readable by non-root users #2194

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/accounts/contacts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ ENV LOG_LEVEL info
# Add application code.
COPY . .

# Ensure files are readable for non-root users
RUN chmod a+r *
Copy link
Member

Choose a reason for hiding this comment

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

This defeats the purpose of running in non-root, since it gives gives access to all files to non-root, potentially creating security issues.

Copy link
Member Author

Choose a reason for hiding this comment

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

Only to the application code and config files in /app -- I can make this more explicit if helpful. Another option would be to chown these to the user/group the pod is configured to run as.


CMD gunicorn -b :$PORT --threads 4 --log-config logging.conf --log-level=$LOG_LEVEL "contacts:create_app()"
3 changes: 3 additions & 0 deletions src/accounts/userservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ ENV LOG_LEVEL info
# Add application code.
COPY . .

# Ensure files are readable for non-root users
RUN chmod a+r *

# Start server using gunicorn
CMD gunicorn -b :$PORT --threads 2 --log-config logging.conf --log-level=$LOG_LEVEL "userservice:create_app()"
3 changes: 3 additions & 0 deletions src/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ ENV LOG_LEVEL info
# Add application code.
COPY . .

# Ensure files are readable for non-root users
RUN find . -type f -name '*' -exec chmod a+r '{}' ';'

# Start server using gunicorn
CMD gunicorn -b :$PORT --threads 4 --log-config logging.conf --log-level=$LOG_LEVEL "frontend:create_app()"