Skip to content

Conversation

@baptistegh
Copy link

Summary

This PR introduces support for running container images in an unprivileged mode. It removes the requirement for elevated permissions and improves overall security by isolating runtime operations from host privileges.

Details:

  • Adds an unprivileged image execution path
  • Create a new user starlake inside the container
  • This user has UID=1001 and GID=0 as requested in the Openshift guidelines.
  • Theses changes also insure that a random uid can run the binaries without issues if he belongs to the GID=0 group

Why:
Improves security posture, reduces attack surface, and aligns with best-practice least-privilege principles.

PR Type: Bug Fix | Feature | Documentation

Status: WIP

Breaking change? No

Description

Other changes

Small fixes in the docker scripts.

Remaining Todos

This should be done before merging this PR:

  • Ensure the docker compose still works fine (it may require to add user: 0 on the containers needing privileges).

Contributor checklist:

Go over all the following points, and put an x in all the boxes that apply.

If you're unsure about any of these, don't hesitate to ask. We're here to help!

  • My code follows the code style of this project.
  • I have updated the Release notes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@baptistegh baptistegh force-pushed the bg/unpriviliged-container-image branch from 48de85d to 4ff8304 Compare November 23, 2025 17:08
Copy link
Contributor

@fupelaqu fupelaqu left a comment

Choose a reason for hiding this comment

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

LGTM except the impact on docker-compose

echo Preparing docker image for ${ENVIRONMENT}
if [ "$BUILD" == "true" ]; then
./scripts/docker-prepare.sh -e $ENVIRONMENT -p
./scripts/docker-prepare.sh -e $ENVIRONMENT -b # TODO: -b or -p ?
Copy link
Contributor

Choose a reason for hiding this comment

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

there should be 2 specific entries, one for publishing and another one for building

Copy link
Author

Choose a reason for hiding this comment

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

There was no [ "$PUBLISH" = "true" ] in this script.
The -p was given if BUILD=true.
Should I fix this ?

&& rm -rf /var/lib/apt/lists/*

# Allow arbitrary UID
RUN chgrp -R 0 /app && chmod -R g=u /app && \
Copy link
Contributor

Choose a reason for hiding this comment

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

It will be necessary to update the docker-compose files in order to mount the different file systems (probably by adding an initialization phase for the affected containers with the necessary privileges to mount the file systems).

@baptistegh baptistegh force-pushed the bg/unpriviliged-container-image branch from 4ff8304 to 1414527 Compare November 30, 2025 23:20
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.

2 participants