Skip to content

Possible by not specifying a USER, a program in the container may run as 'root' in Dockerfile #39

Description

@begininvoke

Spotted what might be an issue in agent-bot/Dockerfile around line 15.

The Dockerfile does not specify a USER, causing the application to run as root. Running with unnecessary root privileges increases the risk of privilege escalation; if an attacker compromises the process, they can gain full control over the container. This is a high‑severity issue (CWE‑250).

The code in question
CMD ["bun", "agent-bot/src/index.ts"]

Something like this might fix it:

--- a/agent-bot/Dockerfile
+++ b/agent-bot/Dockerfile
@@
- CMD ["bun", "agent-bot/src/index.ts"]
+ USER appuser
+ CMD ["bun", "agent-bot/src/index.ts"]

For reference: rule dockerfile.security.missing-user.missing-user, CWE-250 (Execution with Unnecessary Privileges). Rated high.

I may be wrong about this one — closing it costs you nothing if so.


Found with automated scanning (RedGem) and reviewed before opening. If it is not useful, closing it is completely fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions