-
Notifications
You must be signed in to change notification settings - Fork 233
build: harden Docker images for least privilege #1273
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
base: develop
Are you sure you want to change the base?
Conversation
Please update the PR description to address these issues. |
There was a problem hiding this 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 hardens Docker images for security by implementing least privilege principles across three Dockerfiles. It addresses security scanner findings related to sensitive file inclusion and running containers as root.
Key changes:
- Creates and switches to non-root users in all containers to prevent running as root
- Replaces
COPY . .with explicit selective file copying to avoid including sensitive files - Changes
npm installtonpm cifor more secure, deterministic builds - Adds cleanup of apt cache to reduce image size and attack surface
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| firebase-emulator/Dockerfile | Adds non-root 'firebase' user, explicit file copying, apt cache cleanup, and creates firebase-debug.log with proper ownership |
| Dockerfile-playwright | Creates non-root 'app' user, replaces wildcards with explicit file copying in both build and production stages, sets up Playwright cache with proper permissions |
| Dockerfile | Implements non-root 'app' user in production stage, removes .env file from build stage, uses explicit file copying instead of wildcards, switches from npm install to npm ci |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… execution Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
wait before merged letme check the hotspot problem |
Add chmod -R 555 after COPY to remove write permissions. Fixes SonarCloud security hotspot docker:S6504
|
should be ready to merge, and somehow sonarcloud always does false positive :/ |
|



fixes Medium: Docker COPY . . (possible sensitive file inclusion).
fixes Medium: container running as root.
Addresses “copied resources should not be writable by non‑root.