chore: Testing DataDog Dockerfile misconfiguration checks (off-ticket) - #1585
chore: Testing DataDog Dockerfile misconfiguration checks (off-ticket)#1585dragos441 wants to merge 2 commits into
Conversation
|
Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run |
Dependency Review✅ No vulnerabilities or OpenSSF Scorecard issues found.Scanned FilesNone |
|
Your PR has commits that are missing the Signed-off-by trailer. This is likely due to the pre-commit hook not being configured on your local machine. The usual fix for this issue is to run |
🛑 Gate Violations
ℹ️ InfoNo other issues found (see more)🛠️ No new code quality issues Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 3da8dcf | Docs | Datadog PR Page | Give us feedback! |
| FROM ubuntu:latest | ||
|
|
||
| # Bad practice: explicitly running everything as root | ||
| USER root |
There was a problem hiding this comment.
🔴 High: Last user is root
Containers must not run their final process as root because running as root increases the impact of a compromise and can enable privilege escalation or container-to-host attacks.
This rule checks the Dockerfile USER i... (...read more)
USER i... (...read more)Containers must not run their final process as root because running as root increases the impact of a compromise and can enable privilege escalation or container-to-host attacks.
This rule checks the Dockerfile USER instruction and flags Dockerfiles whose last USER is set to root. The final USER must be a non-root username or UID.
If root is required for build-time actions, perform those steps earlier (for example, in a build stage), then create a non-root user and set USER to that account before the final CMD/ENTRYPOINT.
Secure example that switches to a non-root user before runtime:
FROM node:18 AS build
RUN npm ci && npm run build
FROM node:18-slim
WORKDIR /app
COPY --from=build /app/dist .
RUN addgroup --system app && adduser --system --ingroup app app
USER app
CMD ["node", "server.js"]Helpful? 👍/👎
🚩 Report as false positive. Flags the rule for review to improve detection accuracy.
Sloppy Dockerfile full of bad practices (root user, hardcoded password, 777 permissions, etc) that should trigger DataDog code quality checks.
Checklist:
Title:
feat: Add new feature (DBTP-1234)orchore: Correct typo (off-ticket)Description:
Tasks:
Reviewer Checklist