fix: semgrep-missing-user-entrypoint #1175
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request — Semgrep Rule Fix
Rule ID: missing-user-entrypoint
Rule Message: By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'.
File Path: /tools/scanResult/unzipped-2630966798/.github/actions/retest-action/Dockerfile
Line: 7
Summary
This pull request addresses the Semgrep rule violation
missing-user-entrypoint, which flagged that the Dockerfile did not specify a non-root user before defining the entrypoint. Running containers asrootincreases security risk, especially when executing scripts at startup.Change Details
Modified File
.github/actions/retest-action/DockerfileUpdates
appuser.USER appuserbefore theENTRYPOINTdirective to ensure entrypoint execution under a non-root context.entrypoint.shby avoiding root privileges.Rationale
The Semgrep rule indicates that failing to set a non-root user allows the container to run as
root, exposing the system to privilege escalation and container compromise. This PR ensures that the final active user in the Dockerfile is a non-root user, meeting secure Dockerfile best practices.Verification
appuser.Conclusion
This update ensures secure container execution by enforcing non-root user usage in the Dockerfile, resolving the
missing-user-entrypointSemgrep finding.