-
-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
Security Issue: Dockerfile Security Vulnerabilities
Issue: The Dockerfile contains multiple security vulnerabilities that could lead to privilege escalation and container compromise.
Key Problems:
-
Privilege Escalation Risk:
- Uses
USER builderbut then switches back to root implicitly - The
pipenv install --devcommand runs as non-root but may need elevated privileges
- Uses
-
Insecure Package Installation:
- Installs
dockerpackage inside container (unnecessary attack surface) - Uses
--ignore-pipfileflag which bypasses dependency pinning
- Installs
-
Missing Security Hardening:
- No
--no-install-recommendsflag for apk packages - No cleanup of package cache after installation
- No security scanning of installed packages
- No
-
Information Disclosure:
- Exposes build arguments (
user_id,group_id,home,workdir) in image layers
- Exposes build arguments (
Simple Solution:
- Remove unnecessary packages: Remove
dockerfrom apk install - Add package cleanup: Add
rm -rf /var/cache/apk/*after package installation - Use proper dependency management: Remove
--ignore-pipfileflag - Add security hardening: Use
--no-install-recommendsfor apk - Minimize attack surface: Only install packages needed for the specific stage
I’d be happy to work on this and open a PR if you could assign it to me.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels