You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LXC can report a container as unprivileged while its user or group mappings still expose root outside the container.
Fix
MXC checks the complete live UID and GID maps before running the requested command. Unreadable or empty maps, malformed rows, invalid ranges, or any mapping to outside ID 0 reject the workload and trigger a container stop. Stop failures are returned to the caller.
Networking is configured for container startup, using reserved addresses when the container needs one.
Remove the helper-specific tests instead of keeping a helper solely for testing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ee956a7c-701c-4e30-ba23-88ed75d298fc
Configured status can report an unprivileged container even when it retains the host user namespace.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ee956a7c-701c-4e30-ba23-88ed75d298fc
Use complete command output instead of the bounded helper; inspection now waits for lxc-attach to finish.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ee956a7c-701c-4e30-ba23-88ed75d298fc
A readable shifted-root range is sufficient; unreadable or nonmatching rows do not veto admission.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ee956a7c-701c-4e30-ba23-88ed75d298fc
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The LXC admission check trusts forgeable guest output, exposes host environment variables, and breaks existing SDK and CI flows without the required unprivileged provisioning and migration support.
This PR adds an unprivileged-container admission check to MXC’s LXC backend, intended to reject privileged containers before executing the requested workload.
Changes:
Inspect the live UID mapping after startup and stop containers that fail validation.
Add a regression scenario for misleading LXC privilege metadata and include it in the LXC suite.
Document unprivileged-container requirements and raise the minimum Linux kernel version to 3.12.
File
Description
tests/scripts/run_lxc_unprivileged_test.sh
Tests rejection, workload prevention, and cleanup for an identity-mapped container.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The admission check trusts guest-controlled output and can expose host credentials, while the V1 compatibility break lacks the required security-servicing documentation and migration guidance.
Configure shifted UID/GID mappings in all CI hosts
.github/workflows/lxc-e2e.yml:51
[P1] Scheduled LXC validation (scripts/ci/prepare-linux-host.sh) and Azure SDK integration (.azure-pipelines/templates/SDK.Integration.Test.Job.yml) still install LXC without configuring shifted mappings or root subordinate UID/GID ranges. On clean hosts with default LXC configuration, the new admission check rejects their normal success-path scenarios. Provision the mappings and required mapping tools in those entry points too, preferably through shared host setup with appropriate cleanup.
The streaming and PTY cases need no host files; sharing /tmp can prevent mapped-container startup on hosts with nested mounts.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ee956a7c-701c-4e30-ba23-88ed75d298fc
Namespace entry restored capabilities dropped on the host, allowing raw-socket traffic through the ICMP allowance. Reading UID mappings on the host avoids trusting guest code during admission.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ee956a7c-701c-4e30-ba23-88ed75d298fc
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved issues include a V1 networking compatibility break, a cross-container reply isolation bypass, and cleanup that can leave active workloads running without network restrictions.
Install policy in the container's network namespace before init with network capabilities already removed; networkless creation does not prevent later networked reuse.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8d35d189-89d3-400f-aaef-a33c8ce5860c
Keep the HTTP probes behavioral instead of adding firewall introspection to satisfy a stale inventory.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8d35d189-89d3-400f-aaef-a33c8ce5860c
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The reservation shell lacks cancellation-aware process ownership and inherits blocked fatal signals, allowing it and its descendants to survive executor exit while holding the reservation lock or modifying shared lxc-net configuration.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved findings expose host firewall changes before admission checks, reservation subprocesses that can outlive cancellation, scheduled LXC validation failures, and lost preserved-policy regression coverage.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The untracked reservation shell can outlive cancellation and continue changing host networking, while scheduled LXC validation lacks the UID/GID mappings required to pass unprivileged-container checks.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Startup cancellation can leave the untracked reservation helper running as root after MXC exits, allowing it to modify shared dnsmasq configuration or retain the reservation lock without completing cleanup.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The reservation helper bypasses startup process ownership and inherits blocked termination signals, so cancellation can leave a root process modifying shared network configuration after MXC exits.
Validate both complete maps instead of treating one shifted UID row as proof that the container is unprivileged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4a64f88e-58c0-48bf-a5b2-c07d15557095
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because functional coverage does not verify retained-container filtering after executor exit or rejection of containers retaining the host user namespace.
Could we add a CI-wired lxc-exec E2E covering valid shifted maps, an identity GID map, and a non-root container UID mapped to host UID 0? The unit tests don’t verify live admission and cleanup. For rejected cases, please assert the admission error, no workload execution, and a stopped container with destroyOnExit: false.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Needs-AttentionRequires attention or a decision from the MXC maintainers.Needs-Author-FeedbackWaiting for additional information or action from the issue or pull-request author.
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
LXC can report a container as unprivileged while its user or group mappings still expose root outside the container.
Fix
MXC checks the complete live UID and GID maps before running the requested command. Unreadable or empty maps, malformed rows, invalid ranges, or any mapping to outside ID 0 reject the workload and trigger a container stop. Stop failures are returned to the caller.
Networking is configured for container startup, using reserved addresses when the container needs one.
Unprivileged LXC requires Linux 3.12 or later.
✅ Checklist
feature-acceptedCargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type
Microsoft Reviewers: Open in CodeFlow