Skip to content

Fix host UID/GID leakage in copyFileToContainer TAR entries#11488

Open
ym0506 wants to merge 1 commit intotestcontainers:mainfrom
ym0506:codex/fix-copyfile-owner-rootless-clean
Open

Fix host UID/GID leakage in copyFileToContainer TAR entries#11488
ym0506 wants to merge 1 commit intotestcontainers:mainfrom
ym0506:codex/fix-copyfile-owner-rootless-clean

Conversation

@ym0506
Copy link

@ym0506 ym0506 commented Feb 6, 2026

Fixes #11487

Problem

When copyFileToContainer copies a MountableFile, TAR entries are created from host files. The TAR metadata may carry host UID/GID values into the container.

On rootless Docker setups, those IDs may be unmapped, causing permission/ownership issues (e.g. Keycloak dev service failing to read copied config).

Solution

Normalize TAR entry ownership for MountableFile copies:

  • set TAR entry uid=0
  • set TAR entry gid=0

This avoids leaking host identity into the container filesystem metadata.

Tests

Added MountableFileTest#tarEntriesShouldUseRootOwnership to verify generated TAR entries use UID/GID 0.

Related

@ym0506 ym0506 requested a review from a team as a code owner February 6, 2026 00:56
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.

[Bug]:

1 participant