Skip to content

Run runtime images as non-root for Kubernetes compatibility#111

Open
sammcgeown wants to merge 2 commits into
hashicorp:mainfrom
sammcgeown:no-run-as-root
Open

Run runtime images as non-root for Kubernetes compatibility#111
sammcgeown wants to merge 2 commits into
hashicorp:mainfrom
sammcgeown:no-run-as-root

Conversation

@sammcgeown

Copy link
Copy Markdown

Problem: runtime images execute as root by default, which can conflict with Kubernetes best practice and runAsNonRoot policies

Change: set USER 65532:65532 in both runnable stages (dev and release-default) in [Dockerfile]

Impact: security hardening only; command behavior remains unchanged.

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

If you have any questions, please contact your direct supervisor, GRC (#team-grc), or the PCI working group (#proj-pci-reboot). You can also find more information at PCI Compliance.

Copilot AI review requested due to automatic review settings May 15, 2026 13:30
@sammcgeown sammcgeown requested a review from a team as a code owner May 15, 2026 13:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 the container runtime configuration by running the dev and release-default Docker image stages as a non-root user (UID/GID 65532) to better align with Kubernetes runAsNonRoot policies.

Changes:

  • Set USER 65532:65532 in the dev (scratch) runtime stage.
  • Set USER 65532:65532 in the release-default (scratch) runtime stage.
  • Added a changelog entry describing the non-root runtime change.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Dockerfile Runs scratch-based runtime stages as UID/GID 65532 for Kubernetes non-root compatibility.
CHANGELOG.md Notes the runtime image change (currently added at the top of the file).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile
Comment on lines 40 to 45
COPY --from=devbuild /build/vault-mcp-server .
COPY --from=certbuild /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# Run as a non-root user for Kubernetes compatibility.
USER 65532:65532
# Command to run the server
CMD ["./vault-mcp-server", "stdio"]
Comment thread Dockerfile
Comment on lines 66 to 70
COPY dist/$TARGETOS/$TARGETARCH/$BIN_NAME /bin/vault-mcp-server
COPY --from=certbuild /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# Run as a non-root user for Kubernetes compatibility.
USER 65532:65532
CMD ["/bin/vault-mcp-server", "stdio"]
Comment thread CHANGELOG.md
@@ -1,3 +1,6 @@

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.

3 participants