Skip to content

Add USER "app" to Dockerfile #3520

Open
aaronburtle wants to merge 1 commit intomainfrom
dev/aaronburtle/Add-User-Docker-File
Open

Add USER "app" to Dockerfile #3520
aaronburtle wants to merge 1 commit intomainfrom
dev/aaronburtle/Add-User-Docker-File

Conversation

@aaronburtle
Copy link
Copy Markdown
Contributor

Why make this change?

Closes #3514

What is this change?

Adds a user app to our Dockerfile to avoid alterting scanners. For more information see: #3481

How was this tested?

Manually tested.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 updates the container runtime stage to explicitly run Data API Builder as a non-root user (app) to satisfy container security scanners, aligning the Dockerfile with the base image’s intended default user.

Changes:

  • Add explanatory comments documenting the rationale for running as non-root in the final image stage.
  • Set USER app in the runtime stage so scanners see a non-root Config.User.

Comment thread Dockerfile
Comment on lines +20 to +24
# process and does not require root privileges. Declaring USER explicitly
# sets the image's Config.User field so image scanners (e.g. Checkmarx One)
# that require a non-root user in the final stage are satisfied.
# Port 5000 is above 1024 so a non-root user can bind to it without CAP_NET_BIND_SERVICE.
USER app
Copy link
Copy Markdown
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot suggestion is valid.

@Aniruddh25 Aniruddh25 self-assigned this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add USER to the Dockerfile

3 participants